Panda3D
Loading...
Searching...
No Matches
physxD6JointDesc.cxx
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file physxD6JointDesc.cxx
10 * @author enn0x
11 * @date 2009-10-01
12 */
13
14#include "physxD6JointDesc.h"
15#include "physxManager.h"
16#include "physxJointDriveDesc.h"
18
19/**
20 *
21 */
22void PhysxD6JointDesc::
23set_x_motion(PhysxD6JointMotion xMotion) {
24
25 _desc.xMotion = (NxD6JointMotion)xMotion;
26}
27
28/**
29 *
30 */
31void PhysxD6JointDesc::
32set_y_motion(PhysxD6JointMotion yMotion) {
33
34 _desc.yMotion = (NxD6JointMotion)yMotion;
35}
36
37/**
38 *
39 */
40void PhysxD6JointDesc::
41set_z_motion(PhysxD6JointMotion zMotion) {
42
43 _desc.zMotion = (NxD6JointMotion)zMotion;
44}
45
46/**
47 *
48 */
49void PhysxD6JointDesc::
50set_swing1_motion(PhysxD6JointMotion swing1Motion) {
51
52 _desc.swing1Motion = (NxD6JointMotion)swing1Motion;
53}
54
55/**
56 *
57 */
58void PhysxD6JointDesc::
59set_swing2_motion(PhysxD6JointMotion swing2Motion) {
60
61 _desc.swing2Motion = (NxD6JointMotion)swing2Motion;
62}
63
64/**
65 *
66 */
67void PhysxD6JointDesc::
68set_twist_motion(PhysxD6JointMotion twistMotion) {
69
70 _desc.twistMotion = (NxD6JointMotion)twistMotion;
71}
72
73/**
74 *
75 */
76void PhysxD6JointDesc::
77set_x_drive(const PhysxJointDriveDesc &drive) {
78
79 _desc.xDrive = drive._desc;
80}
81
82/**
83 *
84 */
85void PhysxD6JointDesc::
86set_y_drive(const PhysxJointDriveDesc &drive) {
87
88 _desc.yDrive = drive._desc;
89}
90
91/**
92 *
93 */
94void PhysxD6JointDesc::
95set_z_drive(const PhysxJointDriveDesc &drive) {
96
97 _desc.zDrive = drive._desc;
98}
99
100/**
101 *
102 */
103void PhysxD6JointDesc::
104set_swing_drive(const PhysxJointDriveDesc &drive) {
105
106 _desc.swingDrive = drive._desc;
107}
108
109/**
110 *
111 */
112void PhysxD6JointDesc::
113set_twist_drive(const PhysxJointDriveDesc &drive) {
114
115 _desc.twistDrive = drive._desc;
116}
117
118/**
119 *
120 */
121void PhysxD6JointDesc::
122set_slerp_drive(const PhysxJointDriveDesc &drive) {
123
124 _desc.slerpDrive = drive._desc;
125}
126
127/**
128 * Sets or clears a single D6JointFlag flag.
129 */
131set_flag(PhysxD6JointFlag flag, bool value) {
132
133 if (value == true) {
134 _desc.flags |= flag;
135 }
136 else {
137 _desc.flags &= ~(flag);
138 }
139}
140
141/**
142 *
143 */
144void PhysxD6JointDesc::
145set_linear_limit(const PhysxJointLimitSoftDesc &limit) {
146
147 _desc.linearLimit = limit._desc;
148}
149
150/**
151 *
152 */
153void PhysxD6JointDesc::
154set_swing1_limit(const PhysxJointLimitSoftDesc &limit) {
155
156 _desc.swing1Limit = limit._desc;
157}
158
159/**
160 *
161 */
162void PhysxD6JointDesc::
163set_swing2_limit(const PhysxJointLimitSoftDesc &limit) {
164
165 _desc.swing2Limit = limit._desc;
166}
167
168/**
169 *
170 */
171void PhysxD6JointDesc::
172set_twist_limit_low(const PhysxJointLimitSoftDesc &limit) {
173
174 _desc.twistLimit.low = limit._desc;
175}
176
177/**
178 *
179 */
180void PhysxD6JointDesc::
181set_twist_limit_high(const PhysxJointLimitSoftDesc &limit) {
182
183 _desc.twistLimit.high = limit._desc;
184}
185
186/**
187 *
188 */
189void PhysxD6JointDesc::
190set_projection_distance(float distance) {
191
192 _desc.projectionDistance = distance;
193}
194
195/**
196 *
197 */
198void PhysxD6JointDesc::
199set_projection_angle(float angle) {
200
201 _desc.projectionAngle = angle;
202}
203
204/**
205 *
206 */
207void PhysxD6JointDesc::
208set_gear_ratio(float ratio) {
209
210 _desc.gearRatio = ratio;
211}
212
213/**
214 *
215 */
216void PhysxD6JointDesc::
217set_drive_position(const LPoint3f &pos) {
218
219 nassertv(!pos.is_nan());
220 _desc.drivePosition = PhysxManager::point3_to_nxVec3(pos);
221}
222
223/**
224 *
225 */
226void PhysxD6JointDesc::
227set_drive_linear_velocity(const LVector3f &v) {
228
229 nassertv(!v.is_nan());
230 _desc.driveLinearVelocity = PhysxManager::vec3_to_nxVec3(v);
231}
232
233/**
234 *
235 */
236void PhysxD6JointDesc::
237set_drive_angular_velocity(const LVector3f &v) {
238
239 nassertv(!v.is_nan());
240 _desc.driveAngularVelocity = PhysxManager::vec3_to_nxVec3(v);
241}
242
243/**
244 *
245 */
246void PhysxD6JointDesc::
247set_drive_orientation(const LQuaternionf &quat) {
248
249 _desc.driveOrientation = PhysxManager::quat_to_nxQuat(quat);
250}
251
252/**
253 * Use this to enable joint projection. Default is PM_none.
254 */
256set_projection_mode(PhysxProjectionMode mode) {
257
258 _desc.projectionMode = (NxJointProjectionMode)mode;
259}
260
261/**
262 *
263 */
264PhysxEnums::PhysxD6JointMotion PhysxD6JointDesc::
265get_x_motion() const {
266
267 return (PhysxD6JointMotion)_desc.xMotion;
268}
269
270/**
271 *
272 */
273PhysxEnums::PhysxD6JointMotion PhysxD6JointDesc::
274get_y_motion() const {
275
276 return (PhysxD6JointMotion)_desc.yMotion;
277}
278
279/**
280 *
281 */
282PhysxEnums::PhysxD6JointMotion PhysxD6JointDesc::
283get_z_motion() const {
284
285 return (PhysxD6JointMotion)_desc.zMotion;
286}
287
288/**
289 *
290 */
291PhysxEnums::PhysxD6JointMotion PhysxD6JointDesc::
292get_swing1_motion() const {
293
294 return (PhysxD6JointMotion)_desc.swing1Motion;
295}
296
297/**
298 *
299 */
300PhysxEnums::PhysxD6JointMotion PhysxD6JointDesc::
301get_swing2_motion() const {
302
303 return (PhysxD6JointMotion)_desc.swing2Motion;
304}
305
306/**
307 *
308 */
309PhysxEnums::PhysxD6JointMotion PhysxD6JointDesc::
310get_twist_motion() const {
311
312 return (PhysxD6JointMotion)_desc.twistMotion;
313}
314
315/**
316 *
317 */
318PhysxJointDriveDesc PhysxD6JointDesc::
319get_x_drive() const {
320
322 value._desc = _desc.xDrive;
323 return value;
324}
325
326/**
327 *
328 */
329PhysxJointDriveDesc PhysxD6JointDesc::
330get_y_drive() const {
331
333 value._desc = _desc.yDrive;
334 return value;
335}
336
337/**
338 *
339 */
340PhysxJointDriveDesc PhysxD6JointDesc::
341get_z_drive() const {
342
344 value._desc = _desc.zDrive;
345 return value;
346}
347
348/**
349 *
350 */
351PhysxJointDriveDesc PhysxD6JointDesc::
352get_swing_drive() const {
353
355 value._desc = _desc.swingDrive;
356 return value;
357}
358
359/**
360 *
361 */
362PhysxJointDriveDesc PhysxD6JointDesc::
363get_twist_drive() const {
364
366 value._desc = _desc.twistDrive;
367 return value;
368}
369
370/**
371 *
372 */
373PhysxJointDriveDesc PhysxD6JointDesc::
374get_slerp_drive() const {
375
377 value._desc = _desc.slerpDrive;
378 return value;
379}
380
381/**
382 *
383 */
384bool PhysxD6JointDesc::
385get_flag(PhysxD6JointFlag flag) const {
386
387 return (_desc.flags & flag) ? true : false;
388}
389
390/**
391 *
392 */
393PhysxJointLimitSoftDesc PhysxD6JointDesc::
394get_linear_limit() const {
395
397 value._desc = _desc.linearLimit;
398 return value;
399}
400
401/**
402 *
403 */
404PhysxJointLimitSoftDesc PhysxD6JointDesc::
405get_swing1_limit() const {
406
408 value._desc = _desc.swing1Limit;
409 return value;
410}
411
412/**
413 *
414 */
415PhysxJointLimitSoftDesc PhysxD6JointDesc::
416get_swing2_limit() const {
417
419 value._desc = _desc.swing2Limit;
420 return value;
421}
422
423/**
424 *
425 */
426PhysxJointLimitSoftDesc PhysxD6JointDesc::
427get_twist_limit_low() const {
428
430 value._desc = _desc.twistLimit.low;
431 return value;
432}
433
434/**
435 *
436 */
437PhysxJointLimitSoftDesc PhysxD6JointDesc::
438get_twist_limit_high() const {
439
441 value._desc = _desc.twistLimit.high;
442 return value;
443}
444
445/**
446 *
447 */
448float PhysxD6JointDesc::
449get_projection_distance() const {
450
451 return _desc.projectionDistance;
452}
453
454/**
455 *
456 */
457float PhysxD6JointDesc::
458get_projection_angle() const {
459
460 return _desc.projectionAngle;
461}
462
463/**
464 *
465 */
466float PhysxD6JointDesc::
467get_gear_ratio() const {
468
469 return _desc.gearRatio;
470}
471
472/**
473 *
474 */
475LPoint3f PhysxD6JointDesc::
476get_drive_position() const {
477
478 return PhysxManager::nxVec3_to_point3(_desc.drivePosition);
479}
480
481/**
482 *
483 */
484LVector3f PhysxD6JointDesc::
485get_drive_linear_velocity() const {
486
487 return PhysxManager::nxVec3_to_vec3(_desc.driveLinearVelocity);
488}
489
490/**
491 *
492 */
493LVector3f PhysxD6JointDesc::
494get_drive_angular_velocity() const {
495
496 return PhysxManager::nxVec3_to_vec3(_desc.driveAngularVelocity);
497}
498
499/**
500 *
501 */
502LQuaternionf PhysxD6JointDesc::
503get_drive_orientation() const {
504
505 return PhysxManager::nxQuat_to_quat(_desc.driveOrientation);
506}
507
508/**
509 *
510 */
511PhysxEnums::PhysxProjectionMode PhysxD6JointDesc::
512get_projection_mode() const {
513
514 return (PhysxProjectionMode)_desc.projectionMode;
515}
void set_projection_mode(PhysxProjectionMode mode)
Use this to enable joint projection.
void set_flag(PhysxD6JointFlag flag, bool value)
Sets or clears a single D6JointFlag flag.
Used to describe drive properties for a PhysxD6Joint.
Describes a joint limit.
static NxVec3 vec3_to_nxVec3(const LVector3f &v)
Converts from LVector3f to NxVec3.
static NxVec3 point3_to_nxVec3(const LPoint3f &p)
Converts from LPoint3f to NxVec3.
static LPoint3f nxVec3_to_point3(const NxVec3 &p)
Converts from NxVec3 to LPoint3f.
static NxQuat quat_to_nxQuat(const LQuaternionf &q)
Converts from LQuaternionf to NxQuat.
static LQuaternionf nxQuat_to_quat(const NxQuat &q)
Converts from NxQuat to LQuaternionf.
static LVector3f nxVec3_to_vec3(const NxVec3 &v)
Converts from NxVec3 to LVector3f.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.