summaryrefslogtreecommitdiff
path: root/Runtime/Dynamics/HingeJoint.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-08-14 22:50:43 +0800
committerchai <chaifix@163.com>2019-08-14 22:50:43 +0800
commit15740faf9fe9fe4be08965098bbf2947e096aeeb (patch)
treea730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/Dynamics/HingeJoint.h
+Unity Runtime codeHEADmaster
Diffstat (limited to 'Runtime/Dynamics/HingeJoint.h')
-rw-r--r--Runtime/Dynamics/HingeJoint.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/Runtime/Dynamics/HingeJoint.h b/Runtime/Dynamics/HingeJoint.h
new file mode 100644
index 0000000..b1051e3
--- /dev/null
+++ b/Runtime/Dynamics/HingeJoint.h
@@ -0,0 +1,69 @@
+#ifndef HINGEJOINT_H
+#define HINGEJOINT_H
+
+#include "Runtime/BaseClasses/GameObject.h"
+#include "Runtime/Math/Vector3.h"
+#include "JointDescriptions.h"
+#include "Joint.h"
+class Rigidbody;
+class NxJointDesc;
+class NxRevoluteJoint;
+
+namespace Unity
+{
+
+class HingeJoint : public Joint
+{
+ public:
+
+ REGISTER_DERIVED_CLASS (HingeJoint, Joint)
+ DECLARE_OBJECT_SERIALIZE (HingeJoint)
+
+ HingeJoint (MemLabelId label, ObjectCreationMode mode);
+
+ JointMotor GetMotor () const;
+ void SetMotor (const JointMotor& motor);
+
+ JointLimits GetLimits () const;
+ void SetLimits (const JointLimits& limits);
+
+ JointSpring GetSpring () const;
+ void SetSpring (const JointSpring& spring);
+
+ void SetUseMotor (bool enable);
+ bool GetUseMotor () const;
+
+ void SetUseLimits (bool enable);
+ bool GetUseLimits () const;
+
+ void SetUseSpring (bool enable);
+ bool GetUseSpring () const ;
+
+ // The hinge angle's rate of change (angular velocity).
+ float GetVelocity () const;
+
+ // The hinge's angle
+ float GetAngle () const;
+
+ virtual void ApplySetupAxesToDesc (int option);
+
+ private:
+
+ virtual void Create ();
+
+ void SetSpringNoEnable (const JointSpring& spring);
+ void SetMotorNoEnable (const JointMotor& motor);
+ void SetLimitsNoEnable (const JointLimits& limits);
+
+ JointLimits m_Limits;
+ JointSpring m_Spring;
+ JointMotor m_Motor;
+
+ bool m_UseLimits;
+ bool m_UseMotor;
+ bool m_UseSpring;
+};
+
+}
+
+#endif