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 "BsCorePrerequisites.h"
6#include "Physics/BsD6Joint.h"
7#include "Components/BsCJoint.h"
8
9namespace bs
10{
11 /** @addtogroup Components-Core
12 * @{
13 */
14
15 /**
16 * @copydoc D6Joint
17 *
18 * @note Wraps D6Joint as a Component.
19 */
20 class BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Physics,n:D6Joint) CD6Joint : public CJoint
21 {
22 public:
23 CD6Joint(const HSceneObject& parent);
24
25 /** @copydoc D6Joint::getMotion */
26 BS_SCRIPT_EXPORT(n:GetMotion)
27 D6JointMotion getMotion(D6JointAxis axis) const;
28
29 /** @copydoc D6Joint::setMotion */
30 BS_SCRIPT_EXPORT(n:SetMotion)
31 void setMotion(D6JointAxis axis, D6JointMotion motion);
32
33 /** @copydoc D6Joint::getTwist */
34 BS_SCRIPT_EXPORT(n:Twist,pr:getter)
35 Radian getTwist() const;
36
37 /** @copydoc D6Joint::getSwingY */
38 BS_SCRIPT_EXPORT(n:SwingY,pr:getter)
39 Radian getSwingY() const;
40
41 /** @copydoc D6Joint::getSwingZ */
42 BS_SCRIPT_EXPORT(n:SwingZ,pr:getter)
43 Radian getSwingZ() const;
44
45 /** @copydoc D6Joint::getLimitLinear */
46 BS_SCRIPT_EXPORT(n:LimitLinear,pr:getter)
47 LimitLinear getLimitLinear() const;
48
49 /** @copydoc D6Joint::setLimitLinear */
50 BS_SCRIPT_EXPORT(n:LimitLinear,pr:setter)
51 void setLimitLinear(const LimitLinear& limit);
52
53 /** @copydoc D6Joint::getLimitTwist */
54 BS_SCRIPT_EXPORT(n:LimitTwist,pr:getter)
55 LimitAngularRange getLimitTwist() const;
56
57 /** @copydoc D6Joint::setLimitTwist */
58 BS_SCRIPT_EXPORT(n:LimitTwist,pr:setter)
59 void setLimitTwist(const LimitAngularRange& limit);
60
61 /** @copydoc D6Joint::getLimitSwing */
62 BS_SCRIPT_EXPORT(n:LimitSwing,pr:getter)
63 LimitConeRange getLimitSwing() const;
64
65 /** @copydoc D6Joint::setLimitSwing */
66 BS_SCRIPT_EXPORT(n:LimitSwing,pr:setter)
67 void setLimitSwing(const LimitConeRange& limit);
68
69 /** @copydoc D6Joint::getDrive */
70 BS_SCRIPT_EXPORT(n:GetDrive)
71 D6JointDrive getDrive(D6JointDriveType type) const;
72
73 /** @copydoc D6Joint::setDrive */
74 BS_SCRIPT_EXPORT(n:SetDrive)
75 void setDrive(D6JointDriveType type, const D6JointDrive& drive);
76
77 /** @copydoc D6Joint::getDrivePosition */
78 BS_SCRIPT_EXPORT(n:DrivePosition,pr:getter)
79 Vector3 getDrivePosition() const;
80
81 /** @copydoc D6Joint::getDriveRotation */
82 BS_SCRIPT_EXPORT(n:DriveRotation,pr:getter)
83 Quaternion getDriveRotation() const;
84
85 /** @copydoc D6Joint::setDriveTransform */
86 BS_SCRIPT_EXPORT(n:SetDriveTransform)
87 void setDriveTransform(const Vector3& position, const Quaternion& rotation);
88
89 /** @copydoc D6Joint::getDriveLinearVelocity */
90 BS_SCRIPT_EXPORT(n:DriveLinearVelocity,pr:getter)
91 Vector3 getDriveLinearVelocity() const;
92
93 /** @copydoc D6Joint::getDriveAngularVelocity */
94 BS_SCRIPT_EXPORT(n:DriveAngularVelocity,pr:getter)
95 Vector3 getDriveAngularVelocity() const;
96
97 /** @copydoc D6Joint::setDriveVelocity */
98 BS_SCRIPT_EXPORT(n:SetDriveVelocity)
99 void setDriveVelocity(const Vector3& linear, const Vector3& angular);
100
101 /** @name Internal
102 * @{
103 */
104
105 /** Returns the D6 joint that this component wraps. */
106 D6Joint* _getInternal() const { return static_cast<D6Joint*>(mInternal.get()); }
107
108 /** @} */
109
110 /************************************************************************/
111 /* COMPONENT OVERRIDES */
112 /************************************************************************/
113 protected:
114 friend class SceneObject;
115
116 /** @copydoc CJoint::createInternal */
117 SPtr<Joint> createInternal() override;
118
119 D6_JOINT_DESC mDesc;
120
121 /************************************************************************/
122 /* RTTI */
123 /************************************************************************/
124 public:
125 friend class CD6JointRTTI;
126 static RTTITypeBase* getRTTIStatic();
127 RTTITypeBase* getRTTI() const override;
128
129 protected:
130 CD6Joint(); // Serialization only
131 };
132
133 /** @} */
134}