| 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/BsFJoint.h" |
| 7 | #include "extensions/PxJoint.h" |
| 8 | |
| 9 | namespace bs |
| 10 | { |
| 11 | /** @addtogroup PhysX |
| 12 | * @{ |
| 13 | */ |
| 14 | |
| 15 | /** PhysX implementation of an FJoint. */ |
| 16 | class FPhysXJoint : public FJoint |
| 17 | { |
| 18 | public: |
| 19 | FPhysXJoint(physx::PxJoint* joint, const JOINT_DESC& desc); |
| 20 | ~FPhysXJoint(); |
| 21 | |
| 22 | /** @copydoc FJoint::getBody */ |
| 23 | Rigidbody* getBody(JointBody body) const override; |
| 24 | |
| 25 | /** @copydoc FJoint::setBody */ |
| 26 | void setBody(JointBody body, Rigidbody* value) override; |
| 27 | |
| 28 | /** @copydoc FJoint::getPosition */ |
| 29 | Vector3 getPosition(JointBody body) const override; |
| 30 | |
| 31 | /** @copydoc FJoint::getRotation */ |
| 32 | Quaternion getRotation(JointBody body) const override; |
| 33 | |
| 34 | /** @copydoc FJoint::setTransform */ |
| 35 | void setTransform(JointBody body, const Vector3& position, const Quaternion& rotation) override; |
| 36 | |
| 37 | /** @copydoc FJoint::getBreakForce */ |
| 38 | float getBreakForce() const override; |
| 39 | |
| 40 | /** @copydoc FJoint::setBreakForce */ |
| 41 | void setBreakForce(float force) override; |
| 42 | |
| 43 | /** @copydoc FJoint::getBreakTorque */ |
| 44 | float getBreakTorque() const override; |
| 45 | |
| 46 | /** @copydoc FJoint::setBreakTorque */ |
| 47 | void setBreakTorque(float torque) override; |
| 48 | |
| 49 | /** @copydoc FJoint::getEnableCollision */ |
| 50 | bool getEnableCollision() const override; |
| 51 | |
| 52 | /** @copydoc FJoint::setEnableCollision */ |
| 53 | void setEnableCollision(bool value) override; |
| 54 | |
| 55 | /** Gets the internal PhysX joint object. */ |
| 56 | physx::PxJoint* _getInternal() const { return mJoint; } |
| 57 | protected: |
| 58 | physx::PxJoint* mJoint; |
| 59 | }; |
| 60 | |
| 61 | /** @} */ |
| 62 | } |