| 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/BsHingeJoint.h" |
| 7 | #include "PxPhysics.h" |
| 8 | #include "extensions/PxRevoluteJoint.h" |
| 9 | |
| 10 | namespace bs |
| 11 | { |
| 12 | /** @addtogroup PhysX |
| 13 | * @{ |
| 14 | */ |
| 15 | |
| 16 | /** PhysX implementation of a HingeJoint. */ |
| 17 | class PhysXHingeJoint : public HingeJoint |
| 18 | { |
| 19 | public: |
| 20 | PhysXHingeJoint(physx::PxPhysics* physx, const HINGE_JOINT_DESC& desc); |
| 21 | ~PhysXHingeJoint(); |
| 22 | |
| 23 | /** @copydoc HingeJoint::getAngle */ |
| 24 | Radian getAngle() const override; |
| 25 | |
| 26 | /** @copydoc HingeJoint::getSpeed */ |
| 27 | float getSpeed() const override; |
| 28 | |
| 29 | /** @copydoc HingeJoint::getLimit */ |
| 30 | LimitAngularRange getLimit() const override; |
| 31 | |
| 32 | /** @copydoc HingeJoint::setLimit */ |
| 33 | void setLimit(const LimitAngularRange& limit) override; |
| 34 | |
| 35 | /** @copydoc HingeJoint::getDrive */ |
| 36 | HingeJointDrive getDrive() const override; |
| 37 | |
| 38 | /** @copydoc HingeJoint::setDrive */ |
| 39 | void setDrive(const HingeJointDrive& drive) override; |
| 40 | |
| 41 | /** @copydoc HingeJoint::setFlag */ |
| 42 | void setFlag(HingeJointFlag flag, bool enabled) override; |
| 43 | |
| 44 | /** @copydoc HingeJoint::hasFlag */ |
| 45 | bool hasFlag(HingeJointFlag flag) const override; |
| 46 | |
| 47 | private: |
| 48 | /** Returns the internal PhysX representation of the hinge (revolute) joint. */ |
| 49 | inline physx::PxRevoluteJoint* getInternal() const; |
| 50 | }; |
| 51 | |
| 52 | /** @} */ |
| 53 | } |