| 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/BsD6Joint.h" |
| 7 | #include "PxPhysics.h" |
| 8 | #include "extensions/PxD6Joint.h" |
| 9 | |
| 10 | namespace bs |
| 11 | { |
| 12 | /** @addtogroup PhysX |
| 13 | * @{ |
| 14 | */ |
| 15 | |
| 16 | /** PhysX implementation of a D6 joint. */ |
| 17 | class PhysXD6Joint : public D6Joint |
| 18 | { |
| 19 | public: |
| 20 | PhysXD6Joint(physx::PxPhysics* physx, const D6_JOINT_DESC& desc); |
| 21 | ~PhysXD6Joint(); |
| 22 | |
| 23 | /** @copydoc D6Joint::getMotion */ |
| 24 | D6JointMotion getMotion(D6JointAxis axis) const override; |
| 25 | |
| 26 | /** @copydoc D6Joint::setMotion */ |
| 27 | void setMotion(D6JointAxis axis, D6JointMotion motion) override; |
| 28 | |
| 29 | /** @copydoc D6Joint::getTwist */ |
| 30 | Radian getTwist() const override; |
| 31 | |
| 32 | /** @copydoc D6Joint::getSwingY */ |
| 33 | Radian getSwingY() const override; |
| 34 | |
| 35 | /** @copydoc D6Joint::getSwingZ */ |
| 36 | Radian getSwingZ() const override; |
| 37 | |
| 38 | /** @copydoc D6Joint::getLimitLinear */ |
| 39 | LimitLinear getLimitLinear() const override; |
| 40 | |
| 41 | /** @copydoc D6Joint::setLimitLinear */ |
| 42 | void setLimitLinear(const LimitLinear& limit) override; |
| 43 | |
| 44 | /** @copydoc D6Joint::getLimitTwist */ |
| 45 | LimitAngularRange getLimitTwist() const override; |
| 46 | |
| 47 | /** @copydoc D6Joint::setLimitTwist */ |
| 48 | void setLimitTwist(const LimitAngularRange& limit) override; |
| 49 | |
| 50 | /** @copydoc D6Joint::getLimitSwing */ |
| 51 | LimitConeRange getLimitSwing() const override; |
| 52 | |
| 53 | /** @copydoc D6Joint::setLimitSwing */ |
| 54 | void setLimitSwing(const LimitConeRange& limit) override; |
| 55 | |
| 56 | /** @copydoc D6Joint::getDrive */ |
| 57 | D6JointDrive getDrive(D6JointDriveType type) const override; |
| 58 | |
| 59 | /** @copydoc D6Joint::setDrive */ |
| 60 | void setDrive(D6JointDriveType type, const D6JointDrive& drive) override; |
| 61 | |
| 62 | /** @copydoc D6Joint::getDrivePosition */ |
| 63 | Vector3 getDrivePosition() const override; |
| 64 | |
| 65 | /** @copydoc D6Joint::getDriveRotation */ |
| 66 | Quaternion getDriveRotation() const override; |
| 67 | |
| 68 | /** @copydoc D6Joint::setDriveTransform */ |
| 69 | void setDriveTransform(const Vector3& position, const Quaternion& rotation) override; |
| 70 | |
| 71 | /** @copydoc D6Joint::getDriveLinearVelocity */ |
| 72 | Vector3 getDriveLinearVelocity() const override; |
| 73 | |
| 74 | /** @copydoc D6Joint::getDriveAngularVelocity */ |
| 75 | Vector3 getDriveAngularVelocity() const override; |
| 76 | |
| 77 | /** @copydoc D6Joint::setDriveVelocity */ |
| 78 | void setDriveVelocity(const Vector3& linear, const Vector3& angular) override; |
| 79 | |
| 80 | private: |
| 81 | /** Returns the internal PhysX representation of the D6 joint. */ |
| 82 | inline physx::PxD6Joint* getInternal() const; |
| 83 | }; |
| 84 | |
| 85 | /** @} */ |
| 86 | } |