1 | #ifndef NX_PHYSICS_NXD6Joint
|
---|
2 | #define NX_PHYSICS_NXD6Joint
|
---|
3 | /*----------------------------------------------------------------------------*\
|
---|
4 | |
|
---|
5 | | Public Interface to NovodeX Technology
|
---|
6 | |
|
---|
7 | | www.novodex.com
|
---|
8 | |
|
---|
9 | \*----------------------------------------------------------------------------*/
|
---|
10 | /** \addtogroup physics
|
---|
11 | @{
|
---|
12 | */
|
---|
13 |
|
---|
14 | #include "Nxp.h"
|
---|
15 | #include "NxJoint.h"
|
---|
16 |
|
---|
17 | class NxD6JointDesc;
|
---|
18 |
|
---|
19 | /**
|
---|
20 | \brief A D6 joint is a general constraint between two actors.
|
---|
21 |
|
---|
22 | It allows the user to individually define the linear and rotational degrees of freedom.
|
---|
23 | It also allows the user to configure the joint with limits and driven degrees of freedom as they wish.
|
---|
24 |
|
---|
25 | For example to create a fixed joint we would need to do:
|
---|
26 |
|
---|
27 | \code
|
---|
28 | ...
|
---|
29 | d6Desc.twistMotion = NX_D6JOINT_MOTION_LOCKED;
|
---|
30 | d6Desc.swing1Motion = NX_D6JOINT_MOTION_LOCKED;
|
---|
31 | d6Desc.swing2Motion = NX_D6JOINT_MOTION_LOCKED;
|
---|
32 |
|
---|
33 | d6Desc.xMotion = NX_D6JOINT_MOTION_LOCKED;
|
---|
34 | d6Desc.yMotion = NX_D6JOINT_MOTION_LOCKED;
|
---|
35 | d6Desc.zMotion = NX_D6JOINT_MOTION_LOCKED;
|
---|
36 | ...
|
---|
37 | \endcode
|
---|
38 |
|
---|
39 | Or a Revolute joint:
|
---|
40 |
|
---|
41 | \code
|
---|
42 | ...
|
---|
43 | d6Desc.twistMotion = NX_D6JOINT_MOTION_FREE;
|
---|
44 | d6Desc.swing1Motion = NX_D6JOINT_MOTION_LOCKED;
|
---|
45 | d6Desc.swing2Motion = NX_D6JOINT_MOTION_LOCKED;
|
---|
46 |
|
---|
47 | d6Desc.xMotion = NX_D6JOINT_MOTION_LOCKED;
|
---|
48 | d6Desc.yMotion = NX_D6JOINT_MOTION_LOCKED;
|
---|
49 | d6Desc.zMotion = NX_D6JOINT_MOTION_LOCKED;
|
---|
50 | ...
|
---|
51 |
|
---|
52 | \endcode
|
---|
53 |
|
---|
54 | And a spherical joint:
|
---|
55 |
|
---|
56 | \code
|
---|
57 | ...
|
---|
58 | d6Desc.twistMotion = NX_D6JOINT_MOTION_FREE;
|
---|
59 | d6Desc.swing1Motion = NX_D6JOINT_MOTION_FREE;
|
---|
60 | d6Desc.swing2Motion = NX_D6JOINT_MOTION_FREE;
|
---|
61 |
|
---|
62 | d6Desc.xMotion = NX_D6JOINT_MOTION_LOCKED;
|
---|
63 | d6Desc.yMotion = NX_D6JOINT_MOTION_LOCKED;
|
---|
64 | d6Desc.zMotion = NX_D6JOINT_MOTION_LOCKED;
|
---|
65 | ...
|
---|
66 | \endcode
|
---|
67 |
|
---|
68 |
|
---|
69 | <h3>Creation</h3>
|
---|
70 |
|
---|
71 | Example:
|
---|
72 |
|
---|
73 | \include NxD6Joint_Create.cpp
|
---|
74 |
|
---|
75 | <h3>Visulizations:</h3>
|
---|
76 | \li #NX_VISUALIZE_JOINT_LOCAL_AXES
|
---|
77 | \li #NX_VISUALIZE_JOINT_WORLD_AXES
|
---|
78 | \li #NX_VISUALIZE_JOINT_LIMITS
|
---|
79 | \li #NX_VISUALIZE_JOINT_ERROR
|
---|
80 | \li #NX_VISUALIZE_JOINT_FORCE
|
---|
81 | \li #NX_VISUALIZE_JOINT_REDUCED
|
---|
82 |
|
---|
83 | @see NxDjJointDesc NxJoint NxScene.createJoint()
|
---|
84 | */
|
---|
85 | class NxD6Joint: public NxJoint
|
---|
86 | {
|
---|
87 |
|
---|
88 | public:
|
---|
89 |
|
---|
90 | /**
|
---|
91 | \brief Use this for changing a significant number of joint parameters at once.
|
---|
92 |
|
---|
93 | Use the set() methods for changing only a single property at once.
|
---|
94 |
|
---|
95 | <b>Sleeping:</b> Does <b>NOT</b> wake the associated actor up automatically.
|
---|
96 |
|
---|
97 | \param[in] desc The descriptor used to set the state of the object.
|
---|
98 |
|
---|
99 | <b>Platform:</b>
|
---|
100 | \li PC SW: Yes
|
---|
101 | \li PPU : No
|
---|
102 | \li PS3 : Yes
|
---|
103 | \li XB360: Yes
|
---|
104 |
|
---|
105 | @see saveToDesc NxD6JointDesc
|
---|
106 | */
|
---|
107 | virtual void loadFromDesc(const NxD6JointDesc& desc) = 0;
|
---|
108 |
|
---|
109 | /**
|
---|
110 | \brief Writes all of the object's attributes to the desc struct
|
---|
111 |
|
---|
112 | \param[out] desc The descriptor used to retrieve the state of the object.
|
---|
113 |
|
---|
114 | <b>Platform:</b>
|
---|
115 | \li PC SW: Yes
|
---|
116 | \li PPU : No
|
---|
117 | \li PS3 : Yes
|
---|
118 | \li XB360: Yes
|
---|
119 |
|
---|
120 | @see loadFromDesc NxD6JointDesc
|
---|
121 | */
|
---|
122 | virtual void saveToDesc(NxD6JointDesc& desc) = 0;
|
---|
123 |
|
---|
124 |
|
---|
125 | /**
|
---|
126 | \brief Set the drive position goal position when it is being driven.
|
---|
127 |
|
---|
128 | The goal position is specified relative to the joint frame corresponding to actor[0].
|
---|
129 |
|
---|
130 | <b>Sleeping:</b> This call wakes the actor(s) if they are sleeping.
|
---|
131 |
|
---|
132 | \param position The goal position if NX_D6JOINT_DRIVE_POSITION is set for xDrive,yDrive or zDrive. <b>Range:</b> position vector
|
---|
133 |
|
---|
134 | <b>Platform:</b>
|
---|
135 | \li PC SW: Yes
|
---|
136 | \li PPU : No
|
---|
137 | \li PS3 : Yes
|
---|
138 | \li XB360: Yes
|
---|
139 |
|
---|
140 | @see setDriveOrientation() NxD6JointDesc.drivePosition
|
---|
141 | @see NxD6JointDesc
|
---|
142 | */
|
---|
143 | virtual void setDrivePosition(const NxVec3 &position) = 0;
|
---|
144 |
|
---|
145 | /**
|
---|
146 | \brief Set the drive goal orientation when it is being driven.
|
---|
147 |
|
---|
148 | The goal orientation is specified relative to the joint frame corresponding to actor[0].
|
---|
149 |
|
---|
150 | <b>Sleeping:</b> This call wakes the actor(s) if they are sleeping.
|
---|
151 |
|
---|
152 | \param orientation The goal orientation if NX_D6JOINT_DRIVE_POSITION is set for swingDrive or
|
---|
153 | twistDrive. <b>Range:</b> unit quaternion
|
---|
154 |
|
---|
155 | <b>Platform:</b>
|
---|
156 | \li PC SW: Yes
|
---|
157 | \li PPU : No
|
---|
158 | \li PS3 : Yes
|
---|
159 | \li XB360: Yes
|
---|
160 |
|
---|
161 | @see setDrivePosition NxD6JointDesc.driveOrientation
|
---|
162 | */
|
---|
163 | virtual void setDriveOrientation(const NxQuat &orientation) = 0;
|
---|
164 |
|
---|
165 | /**
|
---|
166 | \brief Set the drive goal linear velocity when it is being driven.
|
---|
167 |
|
---|
168 | The drive linear velocity is specified relative to the actor[0] joint frame.
|
---|
169 |
|
---|
170 | <b>Sleeping:</b> This call wakes the actor(s) if they are sleeping.
|
---|
171 |
|
---|
172 | \param linVel The goal velocity if NX_D6JOINT_DRIVE_VELOCITY is set for xDrive,yDrive or zDrive.
|
---|
173 | See #NxD6JointDesc. <b>Range:</b> velocity vector
|
---|
174 |
|
---|
175 | <b>Platform:</b>
|
---|
176 | \li PC SW: Yes
|
---|
177 | \li PPU : No
|
---|
178 | \li PS3 : Yes
|
---|
179 | \li XB360: Yes
|
---|
180 |
|
---|
181 | @see setDriveAngularVelocity NxD6JointDesc.driveLinearVelocity
|
---|
182 | */
|
---|
183 | virtual void setDriveLinearVelocity(const NxVec3 &linVel) = 0;
|
---|
184 |
|
---|
185 | /**
|
---|
186 | \brief Set the drive angular velocity goel when it is being driven.
|
---|
187 |
|
---|
188 | The drive angular velocity is specified relative to the drive orientation target in the case of a slerp drive.
|
---|
189 |
|
---|
190 | The drive angular velocity is specified in the actor[0] joint frame in all other casses.
|
---|
191 |
|
---|
192 | <b>Sleeping:</b> This call wakes the actor(s) if they are sleeping.
|
---|
193 |
|
---|
194 | \param angVel The goal angular velocity if NX_D6JOINT_DRIVE_VELOCITY is set for swingDrive or
|
---|
195 | twistDrive. <b>Range:</b> angular velocity vector
|
---|
196 |
|
---|
197 | <b>Platform:</b>
|
---|
198 | \li PC SW: Yes
|
---|
199 | \li PPU : No
|
---|
200 | \li PS3 : Yes
|
---|
201 | \li XB360: Yes
|
---|
202 |
|
---|
203 | @see setDriveLinearVelocity() NxD6JointDesc.driveAngularVelocity
|
---|
204 | */
|
---|
205 | virtual void setDriveAngularVelocity(const NxVec3 &angVel) = 0;
|
---|
206 | };
|
---|
207 | /** @} */
|
---|
208 | #endif
|
---|
209 |
|
---|
210 |
|
---|
211 | //AGCOPYRIGHTBEGIN
|
---|
212 | ///////////////////////////////////////////////////////////////////////////
|
---|
213 | // Copyright © 2005 AGEIA Technologies.
|
---|
214 | // All rights reserved. www.ageia.com
|
---|
215 | ///////////////////////////////////////////////////////////////////////////
|
---|
216 | //AGCOPYRIGHTEND
|
---|
217 |
|
---|