summaryrefslogtreecommitdiff
path: root/Runtime/Dynamics/HingeJoint.h
blob: b1051e3885a9a39a71aefc88584a4ae2c5b19ea4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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