Panda3D

physxRevoluteJointDesc.cxx

00001 // Filename: physxRevoluteJointDesc.cxx
00002 // Created by:  enn0x (28Sep09)
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 "physxRevoluteJointDesc.h"
00016 #include "physxSpringDesc.h"
00017 #include "physxMotorDesc.h"
00018 #include "physxJointLimitDesc.h"
00019 
00020 ////////////////////////////////////////////////////////////////////
00021 //     Function: PhysxRevoluteJointDesc::set_projection_distance
00022 //       Access: Published
00023 //  Description: Sets the distance beyond which the joint is
00024 //               projected.
00025 ////////////////////////////////////////////////////////////////////
00026 void PhysxRevoluteJointDesc::
00027 set_projection_distance(float distance) {
00028 
00029   _desc.projectionDistance = distance;
00030 }
00031 
00032 ////////////////////////////////////////////////////////////////////
00033 //     Function: PhysxRevoluteJointDesc::set_projection_angle
00034 //       Access: Published
00035 //  Description: Sets the angle beyond which the joint is projected.
00036 ////////////////////////////////////////////////////////////////////
00037 void PhysxRevoluteJointDesc::
00038 set_projection_angle(float angle) {
00039 
00040   _desc.projectionAngle = angle;
00041 }
00042 
00043 ////////////////////////////////////////////////////////////////////
00044 //     Function: PhysxRevoluteJointDesc::set_spring
00045 //       Access: Published
00046 //  Description: Sets an aptional spring. 
00047 ////////////////////////////////////////////////////////////////////
00048 void PhysxRevoluteJointDesc::
00049 set_spring(const PhysxSpringDesc &spring) {
00050 
00051   _desc.spring = spring._desc;
00052 }
00053 
00054 ////////////////////////////////////////////////////////////////////
00055 //     Function: PhysxRevoluteJointDesc::set_flag
00056 //       Access: Published
00057 //  Description: Sets or clears a single RevoluteJointFlag flag.
00058 ////////////////////////////////////////////////////////////////////
00059 void PhysxRevoluteJointDesc::
00060 set_flag(PhysxRevoluteJointFlag flag, bool value) {
00061 
00062   if (value == true) {
00063     _desc.flags |= flag;
00064   }
00065   else {
00066     _desc.flags &= ~(flag);
00067   }
00068 }
00069 
00070 ////////////////////////////////////////////////////////////////////
00071 //     Function: PhysxRevoluteJointDesc::set_projection_mode
00072 //       Access: Published
00073 //  Description: Use this to enable joint projection.
00074 //               Default is PM_none.
00075 ////////////////////////////////////////////////////////////////////
00076 void PhysxRevoluteJointDesc::
00077 set_projection_mode(PhysxProjectionMode mode) {
00078 
00079   _desc.projectionMode = (NxJointProjectionMode)mode;
00080 }
00081 
00082 ////////////////////////////////////////////////////////////////////
00083 //     Function: PhysxRevoluteJointDesc::set_motor
00084 //       Access: Published
00085 //  Description: Sets an optional joint motor.
00086 ////////////////////////////////////////////////////////////////////
00087 void PhysxRevoluteJointDesc::
00088 set_motor(const PhysxMotorDesc &motor) {
00089 
00090   _desc.motor = motor._desc;
00091 }
00092 
00093 ////////////////////////////////////////////////////////////////////
00094 //     Function: PhysxRevoluteJointDesc::set_limit_low
00095 //       Access: Published
00096 //  Description: Sets optional limits for the angular motion of the
00097 //               joint.
00098 ////////////////////////////////////////////////////////////////////
00099 void PhysxRevoluteJointDesc::
00100 set_limit_low(const PhysxJointLimitDesc &low) {
00101 
00102   _desc.limit.low = low._desc;
00103 }
00104 
00105 ////////////////////////////////////////////////////////////////////
00106 //     Function: PhysxRevoluteJointDesc::set_limit_high
00107 //       Access: Published
00108 //  Description: Sets optional limits for the angular motion of the
00109 //               joint.
00110 ////////////////////////////////////////////////////////////////////
00111 void PhysxRevoluteJointDesc::
00112 set_limit_high(const PhysxJointLimitDesc &high) {
00113 
00114   _desc.limit.high = high._desc;
00115 }
00116 
00117 ////////////////////////////////////////////////////////////////////
00118 //     Function: PhysxRevoluteJointDesc::get_projection_distance
00119 //       Access: Published
00120 //  Description: Return the distance beyond which the joint is
00121 //               projected.
00122 ////////////////////////////////////////////////////////////////////
00123 float PhysxRevoluteJointDesc::
00124 get_projection_distance() const {
00125 
00126   return _desc.projectionDistance;
00127 }
00128 
00129 ////////////////////////////////////////////////////////////////////
00130 //     Function: PhysxRevoluteJointDesc::get_projection_angle
00131 //       Access: Published
00132 //  Description: Return the angle beyond which the joint is
00133 //               projected.
00134 ////////////////////////////////////////////////////////////////////
00135 float PhysxRevoluteJointDesc::
00136 get_projection_angle() const {
00137 
00138   return _desc.projectionAngle;
00139 }
00140 
00141 ////////////////////////////////////////////////////////////////////
00142 //     Function: PhysxRevoluteJointDesc::get_spring
00143 //       Access: Published
00144 //  Description: 
00145 ////////////////////////////////////////////////////////////////////
00146 PhysxSpringDesc PhysxRevoluteJointDesc::
00147 get_spring() const {
00148 
00149   PhysxSpringDesc value;
00150   value._desc = _desc.spring;
00151   return value;
00152 }
00153 
00154 ////////////////////////////////////////////////////////////////////
00155 //     Function: PhysxRevoluteJointDesc::get_flag
00156 //       Access: Published
00157 //  Description: 
00158 ////////////////////////////////////////////////////////////////////
00159 bool PhysxRevoluteJointDesc::
00160 get_flag(PhysxRevoluteJointFlag flag) const {
00161 
00162   return (_desc.flags & flag) ? true : false;
00163 }
00164 
00165 ////////////////////////////////////////////////////////////////////
00166 //     Function: PhysxRevoluteJointDesc::get_projection_mode
00167 //       Access: Published
00168 //  Description: 
00169 ////////////////////////////////////////////////////////////////////
00170 PhysxEnums::PhysxProjectionMode PhysxRevoluteJointDesc::
00171 get_projection_mode() const {
00172 
00173   return (PhysxProjectionMode)_desc.projectionMode;
00174 }
00175 
00176 ////////////////////////////////////////////////////////////////////
00177 //     Function: PhysxRevoluteJointDesc::get_motor
00178 //       Access: Published
00179 //  Description: Sets an optional joint motor.
00180 ////////////////////////////////////////////////////////////////////
00181 PhysxMotorDesc PhysxRevoluteJointDesc::
00182 get_motor() const {
00183 
00184   PhysxMotorDesc value;
00185   value._desc = _desc.motor;
00186   return value;
00187 }
00188 
00189 ////////////////////////////////////////////////////////////////////
00190 //     Function: PhysxRevoluteJointDesc::get_limit_low
00191 //       Access: Published
00192 //  Description: 
00193 ////////////////////////////////////////////////////////////////////
00194 PhysxJointLimitDesc PhysxRevoluteJointDesc::
00195 get_limit_low() const {
00196 
00197   PhysxJointLimitDesc value;
00198   value._desc = _desc.limit.low;
00199   return value;
00200 }
00201 
00202 ////////////////////////////////////////////////////////////////////
00203 //     Function: PhysxRevoluteJointDesc::get_limit_high
00204 //       Access: Published
00205 //  Description: 
00206 ////////////////////////////////////////////////////////////////////
00207 PhysxJointLimitDesc PhysxRevoluteJointDesc::
00208 get_limit_high() const {
00209 
00210   PhysxJointLimitDesc value;
00211   value._desc = _desc.limit.high;
00212   return value;
00213 }
00214 
 All Classes Functions Variables Enumerations