Panda3D
 All Classes Functions Variables Enumerations
physxD6JointDesc.cxx
00001 // Filename: physxD6JointDesc.cxx
00002 // Created by:  enn0x (01Octp09)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "physxD6JointDesc.h"
00016 #include "physxManager.h"
00017 #include "physxJointDriveDesc.h"
00018 #include "physxJointLimitSoftDesc.h"
00019 
00020 ////////////////////////////////////////////////////////////////////
00021 //     Function: PhysxD6JointDesc::set_x_motion
00022 //       Access: Published
00023 //  Description: 
00024 ////////////////////////////////////////////////////////////////////
00025 void PhysxD6JointDesc::
00026 set_x_motion(PhysxD6JointMotion xMotion) {
00027 
00028   _desc.xMotion = (NxD6JointMotion)xMotion;
00029 }
00030 
00031 ////////////////////////////////////////////////////////////////////
00032 //     Function: PhysxD6JointDesc::set_y_motion
00033 //       Access: Published
00034 //  Description: 
00035 ////////////////////////////////////////////////////////////////////
00036 void PhysxD6JointDesc::
00037 set_y_motion(PhysxD6JointMotion yMotion) {
00038 
00039   _desc.yMotion = (NxD6JointMotion)yMotion;
00040 }
00041 
00042 ////////////////////////////////////////////////////////////////////
00043 //     Function: PhysxD6JointDesc::set_z_motion
00044 //       Access: Published
00045 //  Description: 
00046 ////////////////////////////////////////////////////////////////////
00047 void PhysxD6JointDesc::
00048 set_z_motion(PhysxD6JointMotion zMotion) {
00049 
00050   _desc.zMotion = (NxD6JointMotion)zMotion;
00051 }
00052 
00053 ////////////////////////////////////////////////////////////////////
00054 //     Function: PhysxD6JointDesc::set_swing1_motion
00055 //       Access: Published
00056 //  Description: 
00057 ////////////////////////////////////////////////////////////////////
00058 void PhysxD6JointDesc::
00059 set_swing1_motion(PhysxD6JointMotion swing1Motion) {
00060 
00061   _desc.swing1Motion = (NxD6JointMotion)swing1Motion;
00062 }
00063 
00064 ////////////////////////////////////////////////////////////////////
00065 //     Function: PhysxD6JointDesc::set_swing2_motion
00066 //       Access: Published
00067 //  Description: 
00068 ////////////////////////////////////////////////////////////////////
00069 void PhysxD6JointDesc::
00070 set_swing2_motion(PhysxD6JointMotion swing2Motion) {
00071 
00072   _desc.swing2Motion = (NxD6JointMotion)swing2Motion;
00073 }
00074 
00075 ////////////////////////////////////////////////////////////////////
00076 //     Function: PhysxD6JointDesc::set_twist_motion
00077 //       Access: Published
00078 //  Description: 
00079 ////////////////////////////////////////////////////////////////////
00080 void PhysxD6JointDesc::
00081 set_twist_motion(PhysxD6JointMotion twistMotion) {
00082 
00083   _desc.twistMotion = (NxD6JointMotion)twistMotion;
00084 }
00085 
00086 ////////////////////////////////////////////////////////////////////
00087 //     Function: PhysxD6JointDesc::set_x_drive
00088 //       Access: Published
00089 //  Description: 
00090 ////////////////////////////////////////////////////////////////////
00091 void PhysxD6JointDesc::
00092 set_x_drive(const PhysxJointDriveDesc &drive) {
00093 
00094   _desc.xDrive = drive._desc;
00095 }
00096 
00097 ////////////////////////////////////////////////////////////////////
00098 //     Function: PhysxD6JointDesc::set_y_drive
00099 //       Access: Published
00100 //  Description: 
00101 ////////////////////////////////////////////////////////////////////
00102 void PhysxD6JointDesc::
00103 set_y_drive(const PhysxJointDriveDesc &drive) {
00104 
00105   _desc.yDrive = drive._desc;
00106 }
00107 
00108 ////////////////////////////////////////////////////////////////////
00109 //     Function: PhysxD6JointDesc::set_z_drive
00110 //       Access: Published
00111 //  Description: 
00112 ////////////////////////////////////////////////////////////////////
00113 void PhysxD6JointDesc::
00114 set_z_drive(const PhysxJointDriveDesc &drive) {
00115 
00116   _desc.zDrive = drive._desc;
00117 }
00118 
00119 ////////////////////////////////////////////////////////////////////
00120 //     Function: PhysxD6JointDesc::set_swing_drive
00121 //       Access: Published
00122 //  Description: 
00123 ////////////////////////////////////////////////////////////////////
00124 void PhysxD6JointDesc::
00125 set_swing_drive(const PhysxJointDriveDesc &drive) {
00126 
00127   _desc.swingDrive = drive._desc;
00128 }
00129 
00130 ////////////////////////////////////////////////////////////////////
00131 //     Function: PhysxD6JointDesc::set_twist_drive
00132 //       Access: Published
00133 //  Description: 
00134 ////////////////////////////////////////////////////////////////////
00135 void PhysxD6JointDesc::
00136 set_twist_drive(const PhysxJointDriveDesc &drive) {
00137 
00138   _desc.twistDrive = drive._desc;
00139 }
00140 
00141 ////////////////////////////////////////////////////////////////////
00142 //     Function: PhysxD6JointDesc::set_slerp_drive
00143 //       Access: Published
00144 //  Description: 
00145 ////////////////////////////////////////////////////////////////////
00146 void PhysxD6JointDesc::
00147 set_slerp_drive(const PhysxJointDriveDesc &drive) {
00148 
00149   _desc.slerpDrive = drive._desc;
00150 }
00151 
00152 ////////////////////////////////////////////////////////////////////
00153 //     Function: PhysxD6JointDesc::set_flag
00154 //       Access: Published
00155 //  Description: Sets or clears a single D6JointFlag flag.
00156 ////////////////////////////////////////////////////////////////////
00157 void PhysxD6JointDesc::
00158 set_flag(PhysxD6JointFlag flag, bool value) {
00159 
00160   if (value == true) {
00161     _desc.flags |= flag;
00162   }
00163   else {
00164     _desc.flags &= ~(flag);
00165   }
00166 }
00167 
00168 ////////////////////////////////////////////////////////////////////
00169 //     Function: PhysxD6JointDesc::set_linear_limit
00170 //       Access: Published
00171 //  Description: 
00172 ////////////////////////////////////////////////////////////////////
00173 void PhysxD6JointDesc::
00174 set_linear_limit(const PhysxJointLimitSoftDesc &limit) {
00175 
00176   _desc.linearLimit = limit._desc;
00177 }
00178 
00179 ////////////////////////////////////////////////////////////////////
00180 //     Function: PhysxD6JointDesc::set_swing1_limit
00181 //       Access: Published
00182 //  Description: 
00183 ////////////////////////////////////////////////////////////////////
00184 void PhysxD6JointDesc::
00185 set_swing1_limit(const PhysxJointLimitSoftDesc &limit) {
00186 
00187   _desc.swing1Limit = limit._desc;
00188 }
00189 
00190 ////////////////////////////////////////////////////////////////////
00191 //     Function: PhysxD6JointDesc::set_swing2_limit
00192 //       Access: Published
00193 //  Description: 
00194 ////////////////////////////////////////////////////////////////////
00195 void PhysxD6JointDesc::
00196 set_swing2_limit(const PhysxJointLimitSoftDesc &limit) {
00197 
00198   _desc.swing2Limit = limit._desc;
00199 }
00200 
00201 ////////////////////////////////////////////////////////////////////
00202 //     Function: PhysxD6JointDesc::set_twist_limit_low
00203 //       Access: Published
00204 //  Description: 
00205 ////////////////////////////////////////////////////////////////////
00206 void PhysxD6JointDesc::
00207 set_twist_limit_low(const PhysxJointLimitSoftDesc &limit) {
00208 
00209   _desc.twistLimit.low = limit._desc;
00210 }
00211 
00212 ////////////////////////////////////////////////////////////////////
00213 //     Function: PhysxD6JointDesc::set_twist_limit_high
00214 //       Access: Published
00215 //  Description: 
00216 ////////////////////////////////////////////////////////////////////
00217 void PhysxD6JointDesc::
00218 set_twist_limit_high(const PhysxJointLimitSoftDesc &limit) {
00219 
00220   _desc.twistLimit.high = limit._desc;
00221 }
00222 
00223 ////////////////////////////////////////////////////////////////////
00224 //     Function: PhysxD6JointDesc::set_projection_distance
00225 //       Access: Published
00226 //  Description: 
00227 ////////////////////////////////////////////////////////////////////
00228 void PhysxD6JointDesc::
00229 set_projection_distance(float distance) {
00230 
00231   _desc.projectionDistance = distance;
00232 }
00233 
00234 ////////////////////////////////////////////////////////////////////
00235 //     Function: PhysxD6JointDesc::set_projection_angle
00236 //       Access: Published
00237 //  Description: 
00238 ////////////////////////////////////////////////////////////////////
00239 void PhysxD6JointDesc::
00240 set_projection_angle(float angle) {
00241 
00242   _desc.projectionAngle = angle;
00243 }
00244 
00245 ////////////////////////////////////////////////////////////////////
00246 //     Function: PhysxD6JointDesc::set_gear_ratio
00247 //       Access: Published
00248 //  Description: 
00249 ////////////////////////////////////////////////////////////////////
00250 void PhysxD6JointDesc::
00251 set_gear_ratio(float ratio) {
00252 
00253   _desc.gearRatio = ratio;
00254 }
00255 
00256 ////////////////////////////////////////////////////////////////////
00257 //     Function: PhysxD6JointDesc::set_drive_position
00258 //       Access: Published
00259 //  Description: 
00260 ////////////////////////////////////////////////////////////////////
00261 void PhysxD6JointDesc::
00262 set_drive_position(const LPoint3f &pos) {
00263 
00264   nassertv(!pos.is_nan());
00265   _desc.drivePosition = PhysxManager::point3_to_nxVec3(pos);
00266 }
00267 
00268 ////////////////////////////////////////////////////////////////////
00269 //     Function: PhysxD6JointDesc::set_drive_linear_velocity
00270 //       Access: Published
00271 //  Description: 
00272 ////////////////////////////////////////////////////////////////////
00273 void PhysxD6JointDesc::
00274 set_drive_linear_velocity(const LVector3f &v) {
00275 
00276   nassertv(!v.is_nan());
00277   _desc.driveLinearVelocity = PhysxManager::vec3_to_nxVec3(v);
00278 }
00279 
00280 ////////////////////////////////////////////////////////////////////
00281 //     Function: PhysxD6JointDesc::set_drive_angular_velocity
00282 //       Access: Published
00283 //  Description: 
00284 ////////////////////////////////////////////////////////////////////
00285 void PhysxD6JointDesc::
00286 set_drive_angular_velocity(const LVector3f &v) {
00287 
00288   nassertv(!v.is_nan());
00289   _desc.driveAngularVelocity = PhysxManager::vec3_to_nxVec3(v);
00290 }
00291 
00292 ////////////////////////////////////////////////////////////////////
00293 //     Function: PhysxD6JointDesc::set_drive_orientation
00294 //       Access: Published
00295 //  Description: 
00296 ////////////////////////////////////////////////////////////////////
00297 void PhysxD6JointDesc::
00298 set_drive_orientation(const LQuaternionf &quat) {
00299 
00300   _desc.driveOrientation = PhysxManager::quat_to_nxQuat(quat);
00301 }
00302 
00303 ////////////////////////////////////////////////////////////////////
00304 //     Function: PhysxD6JointDesc::set_projection_mode
00305 //       Access: Published
00306 //  Description: Use this to enable joint projection.
00307 //               Default is PM_none.
00308 ////////////////////////////////////////////////////////////////////
00309 void PhysxD6JointDesc::
00310 set_projection_mode(PhysxProjectionMode mode) {
00311 
00312   _desc.projectionMode = (NxJointProjectionMode)mode;
00313 }
00314 
00315 ////////////////////////////////////////////////////////////////////
00316 //     Function: PhysxD6JointDesc::get_x_motion
00317 //       Access: Published
00318 //  Description: 
00319 ////////////////////////////////////////////////////////////////////
00320 PhysxEnums::PhysxD6JointMotion PhysxD6JointDesc::
00321 get_x_motion() const {
00322 
00323   return (PhysxD6JointMotion)_desc.xMotion;
00324 }
00325 
00326 ////////////////////////////////////////////////////////////////////
00327 //     Function: PhysxD6JointDesc::get_y_motion
00328 //       Access: Published
00329 //  Description: 
00330 ////////////////////////////////////////////////////////////////////
00331 PhysxEnums::PhysxD6JointMotion PhysxD6JointDesc::
00332 get_y_motion() const {
00333 
00334   return (PhysxD6JointMotion)_desc.yMotion;
00335 }
00336 
00337 ////////////////////////////////////////////////////////////////////
00338 //     Function: PhysxD6JointDesc::get_z_motion
00339 //       Access: Published
00340 //  Description: 
00341 ////////////////////////////////////////////////////////////////////
00342 PhysxEnums::PhysxD6JointMotion PhysxD6JointDesc::
00343 get_z_motion() const {
00344 
00345   return (PhysxD6JointMotion)_desc.zMotion;
00346 }
00347 
00348 ////////////////////////////////////////////////////////////////////
00349 //     Function: PhysxD6JointDesc::get_swing1_motion
00350 //       Access: Published
00351 //  Description: 
00352 ////////////////////////////////////////////////////////////////////
00353 PhysxEnums::PhysxD6JointMotion PhysxD6JointDesc::
00354 get_swing1_motion() const {
00355 
00356   return (PhysxD6JointMotion)_desc.swing1Motion;
00357 }
00358 
00359 ////////////////////////////////////////////////////////////////////
00360 //     Function: PhysxD6JointDesc::get_swing2_motion
00361 //       Access: Published
00362 //  Description: 
00363 ////////////////////////////////////////////////////////////////////
00364 PhysxEnums::PhysxD6JointMotion PhysxD6JointDesc::
00365 get_swing2_motion() const {
00366 
00367   return (PhysxD6JointMotion)_desc.swing2Motion;
00368 }
00369 
00370 ////////////////////////////////////////////////////////////////////
00371 //     Function: PhysxD6JointDesc::get_twist_motion
00372 //       Access: Published
00373 //  Description: 
00374 ////////////////////////////////////////////////////////////////////
00375 PhysxEnums::PhysxD6JointMotion PhysxD6JointDesc::
00376 get_twist_motion() const {
00377 
00378   return (PhysxD6JointMotion)_desc.twistMotion;
00379 }
00380 
00381 ////////////////////////////////////////////////////////////////////
00382 //     Function: PhysxD6JointDesc::get_x_drive
00383 //       Access: Published
00384 //  Description: 
00385 ////////////////////////////////////////////////////////////////////
00386 PhysxJointDriveDesc PhysxD6JointDesc::
00387 get_x_drive() const {
00388 
00389   PhysxJointDriveDesc value;
00390   value._desc = _desc.xDrive;
00391   return value;
00392 }
00393 
00394 ////////////////////////////////////////////////////////////////////
00395 //     Function: PhysxD6JointDesc::get_y_drive
00396 //       Access: Published
00397 //  Description: 
00398 ////////////////////////////////////////////////////////////////////
00399 PhysxJointDriveDesc PhysxD6JointDesc::
00400 get_y_drive() const {
00401 
00402   PhysxJointDriveDesc value;
00403   value._desc = _desc.yDrive;
00404   return value;
00405 }
00406 
00407 ////////////////////////////////////////////////////////////////////
00408 //     Function: PhysxD6JointDesc::get_z_drive
00409 //       Access: Published
00410 //  Description: 
00411 ////////////////////////////////////////////////////////////////////
00412 PhysxJointDriveDesc PhysxD6JointDesc::
00413 get_z_drive() const {
00414 
00415   PhysxJointDriveDesc value;
00416   value._desc = _desc.zDrive;
00417   return value;
00418 }
00419 
00420 ////////////////////////////////////////////////////////////////////
00421 //     Function: PhysxD6JointDesc::get_swing_drive
00422 //       Access: Published
00423 //  Description: 
00424 ////////////////////////////////////////////////////////////////////
00425 PhysxJointDriveDesc PhysxD6JointDesc::
00426 get_swing_drive() const {
00427 
00428   PhysxJointDriveDesc value;
00429   value._desc = _desc.swingDrive;
00430   return value;
00431 }
00432 
00433 ////////////////////////////////////////////////////////////////////
00434 //     Function: PhysxD6JointDesc::get_twist_drive
00435 //       Access: Published
00436 //  Description: 
00437 ////////////////////////////////////////////////////////////////////
00438 PhysxJointDriveDesc PhysxD6JointDesc::
00439 get_twist_drive() const {
00440 
00441   PhysxJointDriveDesc value;
00442   value._desc = _desc.twistDrive;
00443   return value;
00444 }
00445 
00446 ////////////////////////////////////////////////////////////////////
00447 //     Function: PhysxD6JointDesc::get_slerp_drive
00448 //       Access: Published
00449 //  Description: 
00450 ////////////////////////////////////////////////////////////////////
00451 PhysxJointDriveDesc PhysxD6JointDesc::
00452 get_slerp_drive() const {
00453 
00454   PhysxJointDriveDesc value;
00455   value._desc = _desc.slerpDrive;
00456   return value;
00457 }
00458 
00459 ////////////////////////////////////////////////////////////////////
00460 //     Function: PhysxD6JointDesc::get_flag
00461 //       Access: Published
00462 //  Description: 
00463 ////////////////////////////////////////////////////////////////////
00464 bool PhysxD6JointDesc::
00465 get_flag(PhysxD6JointFlag flag) const {
00466 
00467   return (_desc.flags & flag) ? true : false;
00468 }
00469 
00470 ////////////////////////////////////////////////////////////////////
00471 //     Function: PhysxD6JointDesc::get_linear_limit
00472 //       Access: Published
00473 //  Description: 
00474 ////////////////////////////////////////////////////////////////////
00475 PhysxJointLimitSoftDesc PhysxD6JointDesc::
00476 get_linear_limit() const {
00477 
00478   PhysxJointLimitSoftDesc value;
00479   value._desc = _desc.linearLimit;
00480   return value;
00481 }
00482 
00483 ////////////////////////////////////////////////////////////////////
00484 //     Function: PhysxD6JointDesc::get_swing1_limit
00485 //       Access: Published
00486 //  Description: 
00487 ////////////////////////////////////////////////////////////////////
00488 PhysxJointLimitSoftDesc PhysxD6JointDesc::
00489 get_swing1_limit() const {
00490 
00491   PhysxJointLimitSoftDesc value;
00492   value._desc = _desc.swing1Limit;
00493   return value;
00494 }
00495 
00496 ////////////////////////////////////////////////////////////////////
00497 //     Function: PhysxD6JointDesc::get_swing2_limit
00498 //       Access: Published
00499 //  Description: 
00500 ////////////////////////////////////////////////////////////////////
00501 PhysxJointLimitSoftDesc PhysxD6JointDesc::
00502 get_swing2_limit() const {
00503 
00504   PhysxJointLimitSoftDesc value;
00505   value._desc = _desc.swing2Limit;
00506   return value;
00507 }
00508 
00509 ////////////////////////////////////////////////////////////////////
00510 //     Function: PhysxD6JointDesc::get_twist_limit_low
00511 //       Access: Published
00512 //  Description: 
00513 ////////////////////////////////////////////////////////////////////
00514 PhysxJointLimitSoftDesc PhysxD6JointDesc::
00515 get_twist_limit_low() const {
00516 
00517   PhysxJointLimitSoftDesc value;
00518   value._desc = _desc.twistLimit.low;
00519   return value;
00520 }
00521 
00522 ////////////////////////////////////////////////////////////////////
00523 //     Function: PhysxD6JointDesc::get_twist_limit_high
00524 //       Access: Published
00525 //  Description: 
00526 ////////////////////////////////////////////////////////////////////
00527 PhysxJointLimitSoftDesc PhysxD6JointDesc::
00528 get_twist_limit_high() const {
00529 
00530   PhysxJointLimitSoftDesc value;
00531   value._desc = _desc.twistLimit.high;
00532   return value;
00533 }
00534 
00535 ////////////////////////////////////////////////////////////////////
00536 //     Function: PhysxD6JointDesc::get_projection_distance
00537 //       Access: Published
00538 //  Description: 
00539 ////////////////////////////////////////////////////////////////////
00540 float PhysxD6JointDesc::
00541 get_projection_distance() const {
00542 
00543   return _desc.projectionDistance;
00544 }
00545 
00546 ////////////////////////////////////////////////////////////////////
00547 //     Function: PhysxD6JointDesc::get_projection_angle
00548 //       Access: Published
00549 //  Description: 
00550 ////////////////////////////////////////////////////////////////////
00551 float PhysxD6JointDesc::
00552 get_projection_angle() const {
00553 
00554   return _desc.projectionAngle;
00555 }
00556 
00557 ////////////////////////////////////////////////////////////////////
00558 //     Function: PhysxD6JointDesc::get_gear_ratio
00559 //       Access: Published
00560 //  Description: 
00561 ////////////////////////////////////////////////////////////////////
00562 float PhysxD6JointDesc::
00563 get_gear_ratio() const {
00564 
00565   return _desc.gearRatio;
00566 }
00567 
00568 ////////////////////////////////////////////////////////////////////
00569 //     Function: PhysxD6JointDesc::get_drive_position
00570 //       Access: Published
00571 //  Description: 
00572 ////////////////////////////////////////////////////////////////////
00573 LPoint3f PhysxD6JointDesc::
00574 get_drive_position() const {
00575 
00576   return PhysxManager::nxVec3_to_point3(_desc.drivePosition);
00577 }
00578 
00579 ////////////////////////////////////////////////////////////////////
00580 //     Function: PhysxD6JointDesc::get_drive_linear_velocity
00581 //       Access: Published
00582 //  Description: 
00583 ////////////////////////////////////////////////////////////////////
00584 LVector3f PhysxD6JointDesc::
00585 get_drive_linear_velocity() const {
00586 
00587   return PhysxManager::nxVec3_to_vec3(_desc.driveLinearVelocity);
00588 }
00589 
00590 ////////////////////////////////////////////////////////////////////
00591 //     Function: PhysxD6JointDesc::get_drive_angular_velocity
00592 //       Access: Published
00593 //  Description: 
00594 ////////////////////////////////////////////////////////////////////
00595 LVector3f PhysxD6JointDesc::
00596 get_drive_angular_velocity() const {
00597 
00598   return PhysxManager::nxVec3_to_vec3(_desc.driveAngularVelocity);
00599 }
00600 
00601 ////////////////////////////////////////////////////////////////////
00602 //     Function: PhysxD6JointDesc::get_drive_orientation
00603 //       Access: Published
00604 //  Description: 
00605 ////////////////////////////////////////////////////////////////////
00606 LQuaternionf PhysxD6JointDesc::
00607 get_drive_orientation() const {
00608 
00609   return PhysxManager::nxQuat_to_quat(_desc.driveOrientation);
00610 }
00611 
00612 ////////////////////////////////////////////////////////////////////
00613 //     Function: PhysxD6JointDesc::get_projection_mode
00614 //       Access: Published
00615 //  Description: 
00616 ////////////////////////////////////////////////////////////////////
00617 PhysxEnums::PhysxProjectionMode PhysxD6JointDesc::
00618 get_projection_mode() const {
00619 
00620   return (PhysxProjectionMode)_desc.projectionMode;
00621 }
00622 
 All Classes Functions Variables Enumerations