| 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/BsSliderJoint.h" |
| 7 | #include "PxPhysics.h" |
| 8 | #include "extensions/PxPrismaticJoint.h" |
| 9 | |
| 10 | namespace bs |
| 11 | { |
| 12 | /** @addtogroup PhysX |
| 13 | * @{ |
| 14 | */ |
| 15 | |
| 16 | /** PhysX implementation of a SliderJoint. */ |
| 17 | class PhysXSliderJoint : public SliderJoint |
| 18 | { |
| 19 | public: |
| 20 | PhysXSliderJoint(physx::PxPhysics* physx, const SLIDER_JOINT_DESC& desc); |
| 21 | ~PhysXSliderJoint(); |
| 22 | |
| 23 | /** @copydoc SliderJoint::getPosition */ |
| 24 | float getPosition() const override; |
| 25 | |
| 26 | /** @copydoc SliderJoint::getSpeed */ |
| 27 | float getSpeed() const override; |
| 28 | |
| 29 | /** @copydoc SliderJoint::getLimit */ |
| 30 | LimitLinearRange getLimit() const override; |
| 31 | |
| 32 | /** @copydoc SliderJoint::setLimit */ |
| 33 | void setLimit(const LimitLinearRange& limit) override; |
| 34 | |
| 35 | /** @copydoc SliderJoint::setFlag */ |
| 36 | void setFlag(SliderJointFlag flag, bool enabled) override; |
| 37 | |
| 38 | /** @copydoc SliderJoint::hasFlag */ |
| 39 | bool hasFlag(SliderJointFlag flag) const override; |
| 40 | |
| 41 | private: |
| 42 | /** Returns the internal PhysX representation of the slider (prismatic) joint. */ |
| 43 | inline physx::PxPrismaticJoint* getInternal() const; |
| 44 | }; |
| 45 | |
| 46 | /** @} */ |
| 47 | } |