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/BsCapsuleCollider.h"
7#include "PxPhysics.h"
8
9namespace bs
10{
11 /** @addtogroup PhysX
12 * @{
13 */
14
15 /** PhysX implementation of a CapsuleCollider. */
16 class PhysXCapsuleCollider : public CapsuleCollider
17 {
18 public:
19 PhysXCapsuleCollider(physx::PxPhysics* physx, physx::PxScene* scene, const Vector3& position,
20 const Quaternion& rotation, float radius, float halfHeight);
21 ~PhysXCapsuleCollider();
22
23 /** @copydoc CapsuleCollider::setScale() */
24 void setScale(const Vector3& scale) override;
25
26 /** @copydoc CapsuleCollider::setHalfHeight() */
27 void setHalfHeight(float halfHeight) override;
28
29 /** @copydoc CapsuleCollider::getHalfHeight() */
30 float getHalfHeight() const override;
31
32 /** @copydoc CapsuleCollider::setRadius() */
33 void setRadius(float radius) override;
34
35 /** @copydoc CapsuleCollider::getRadius() */
36 float getRadius() const override;
37
38 private:
39 /** Returns the PhysX collider implementation common to all colliders. */
40 FPhysXCollider* getInternal() const;
41
42 /** Applies the capsule geometry to the internal object based on set radius, height and scale. */
43 void applyGeometry();
44
45 float mRadius;
46 float mHalfHeight;
47 };
48
49 /** @} */
50}