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/BsSphereCollider.h" |
7 | #include "PxPhysics.h" |
8 | |
9 | namespace bs |
10 | { |
11 | /** @addtogroup PhysX |
12 | * @{ |
13 | */ |
14 | |
15 | /** PhysX implementation of a SphereCollider. */ |
16 | class PhysXSphereCollider : public SphereCollider |
17 | { |
18 | public: |
19 | PhysXSphereCollider(physx::PxPhysics* physx, physx::PxScene* scene, const Vector3& position, |
20 | const Quaternion& rotation, float radius); |
21 | ~PhysXSphereCollider(); |
22 | |
23 | /** @copydoc SphereCollider::setScale */ |
24 | void setScale(const Vector3& scale) override; |
25 | |
26 | /** @copydoc SphereCollider::setRadius */ |
27 | void setRadius(float radius) override; |
28 | |
29 | /** @copydoc SphereCollider::getRadius */ |
30 | float getRadius() 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 radius and scale. */ |
37 | void applyGeometry(); |
38 | |
39 | float mRadius; |
40 | }; |
41 | |
42 | /** @} */ |
43 | } |