| 1 | //************************************ bs::framework - Copyright 2018 Marko Pintera **************************************// |
| 2 | //*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********// |
| 3 | #pragma once |
| 4 | |
| 5 | #include "BsPhysXPrerequisites.h" |
| 6 | #include "Physics/BsBoxCollider.h" |
| 7 | #include "PxPhysics.h" |
| 8 | |
| 9 | namespace bs |
| 10 | { |
| 11 | /** @addtogroup PhysX |
| 12 | * @{ |
| 13 | */ |
| 14 | |
| 15 | /** PhysX implementation of a BoxCollider. */ |
| 16 | class PhysXBoxCollider : public BoxCollider |
| 17 | { |
| 18 | public: |
| 19 | PhysXBoxCollider(physx::PxPhysics* physx, physx::PxScene* scene, const Vector3& position, |
| 20 | const Quaternion& rotation, const Vector3& extents); |
| 21 | ~PhysXBoxCollider(); |
| 22 | |
| 23 | /** @copydoc BoxCollider::setScale */ |
| 24 | void setScale(const Vector3& scale) override; |
| 25 | |
| 26 | /** @copydoc BoxCollider::setExtents */ |
| 27 | void setExtents(const Vector3& extents) override; |
| 28 | |
| 29 | /** @copydoc BoxCollider::getExtents */ |
| 30 | Vector3 getExtents() const override; |
| 31 | |
| 32 | private: |
| 33 | /** Returns the PhysX collider implementation common to all colliders. */ |
| 34 | FPhysXCollider* getInternal() const; |
| 35 | |
| 36 | /** Applies the sphere geometry to the internal object based on set extents and scale. */ |
| 37 | void applyGeometry(); |
| 38 | |
| 39 | Vector3 mExtents; |
| 40 | }; |
| 41 | |
| 42 | /** @} */ |
| 43 | } |