Panda3D
 All Classes Functions Variables Enumerations
physxWheelShapeDesc.cxx
00001 // Filename: physxWheelShapeDesc.cxx
00002 // Created by:  enn0x (09Nov09)
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 "physxWheelShapeDesc.h"
00016 
00017 ////////////////////////////////////////////////////////////////////
00018 //     Function: PhysxWheelShapeDesc::set_to_default
00019 //       Access: Published
00020 //  Description: (re)sets the structure to the default.
00021 ////////////////////////////////////////////////////////////////////
00022 void PhysxWheelShapeDesc::
00023 set_to_default() {
00024 
00025   _desc.setToDefault();
00026   set_name("");
00027 
00028   _desc.localPose = PhysxManager::mat4_to_nxMat34(LMatrix4f::y_to_z_up_mat());
00029 }
00030 
00031 ////////////////////////////////////////////////////////////////////
00032 //     Function: PhysxWheelShapeDesc::set_radius
00033 //       Access: Published
00034 //  Description: Radius of shape. Must be positive.
00035 ////////////////////////////////////////////////////////////////////
00036 void PhysxWheelShapeDesc::
00037 set_radius(float radius) {
00038 
00039   _desc.radius = radius;
00040 }
00041 
00042 ////////////////////////////////////////////////////////////////////
00043 //     Function: PhysxWheelShapeDesc::get_radius
00044 //       Access: Published
00045 //  Description: Radius of shape.
00046 ////////////////////////////////////////////////////////////////////
00047 float PhysxWheelShapeDesc::
00048 get_radius() const {
00049 
00050   return _desc.radius;
00051 }
00052 
00053 ////////////////////////////////////////////////////////////////////
00054 //     Function: PhysxWheelShapeDesc::set_suspension_travel
00055 //       Access: Published
00056 //  Description: Set the maximum extension distance of suspension
00057 //               along shape's -Y axis.
00058 ////////////////////////////////////////////////////////////////////
00059 void PhysxWheelShapeDesc::
00060 set_suspension_travel(float suspensionTravel) {
00061 
00062   _desc.suspensionTravel = suspensionTravel;
00063 }
00064 
00065 ////////////////////////////////////////////////////////////////////
00066 //     Function: PhysxWheelShapeDesc::get_suspension_travel
00067 //       Access: Published
00068 //  Description: 
00069 ////////////////////////////////////////////////////////////////////
00070 float PhysxWheelShapeDesc::
00071 get_suspension_travel() const {
00072 
00073   return _desc.suspensionTravel;
00074 }
00075 
00076 ////////////////////////////////////////////////////////////////////
00077 //     Function: PhysxWheelShapeDesc::set_inverse_wheel_mass
00078 //       Access: Published
00079 //  Description: Set the inverse mass of the wheel.
00080 ////////////////////////////////////////////////////////////////////
00081 void PhysxWheelShapeDesc::
00082 set_inverse_wheel_mass(float inverseWheelMass) {
00083 
00084   _desc.inverseWheelMass = inverseWheelMass;
00085 }
00086 
00087 ////////////////////////////////////////////////////////////////////
00088 //     Function: PhysxWheelShapeDesc::get_inverse_wheel_mass
00089 //       Access: Published
00090 //  Description: 
00091 ////////////////////////////////////////////////////////////////////
00092 float PhysxWheelShapeDesc::
00093 get_inverse_wheel_mass() const {
00094 
00095   return _desc.inverseWheelMass;
00096 }
00097 
00098 ////////////////////////////////////////////////////////////////////
00099 //     Function: PhysxWheelShapeDesc::set_motor_torque
00100 //       Access: Published
00101 //  Description: Set the sum engine torque on the wheel axle.
00102 ////////////////////////////////////////////////////////////////////
00103 void PhysxWheelShapeDesc::
00104 set_motor_torque(float motorTorque) {
00105 
00106   _desc.motorTorque = motorTorque;
00107 }
00108 
00109 ////////////////////////////////////////////////////////////////////
00110 //     Function: PhysxWheelShapeDesc::get_motor_torque
00111 //       Access: Published
00112 //  Description: 
00113 ////////////////////////////////////////////////////////////////////
00114 float PhysxWheelShapeDesc::
00115 get_motor_torque() const {
00116 
00117   return _desc.motorTorque;
00118 }
00119 
00120 ////////////////////////////////////////////////////////////////////
00121 //     Function: PhysxWheelShapeDesc::set_brake_torque
00122 //       Access: Published
00123 //  Description: Set the amount of torque applied for braking.
00124 ////////////////////////////////////////////////////////////////////
00125 void PhysxWheelShapeDesc::
00126 set_brake_torque(float brakeTorque) {
00127 
00128   _desc.brakeTorque = brakeTorque;
00129 }
00130 
00131 ////////////////////////////////////////////////////////////////////
00132 //     Function: PhysxWheelShapeDesc::get_brake_torque
00133 //       Access: Published
00134 //  Description: 
00135 ////////////////////////////////////////////////////////////////////
00136 float PhysxWheelShapeDesc::
00137 get_brake_torque() const {
00138 
00139   return _desc.brakeTorque;
00140 }
00141 
00142 ////////////////////////////////////////////////////////////////////
00143 //     Function: PhysxWheelShapeDesc::set_steer_angle
00144 //       Access: Published
00145 //  Description: Set the steering angle, around shape Y axis.
00146 //               The steering angle is measured in degrees.
00147 ////////////////////////////////////////////////////////////////////
00148 void PhysxWheelShapeDesc::
00149 set_steer_angle(float steerAngle) {
00150 
00151   _desc.steerAngle = NxMath::degToRad(steerAngle);
00152 }
00153 
00154 ////////////////////////////////////////////////////////////////////
00155 //     Function: PhysxWheelShapeDesc::get_steer_angle
00156 //       Access: Published
00157 //  Description: 
00158 ////////////////////////////////////////////////////////////////////
00159 float PhysxWheelShapeDesc::
00160 get_steer_angle() const {
00161 
00162   return _desc.steerAngle;
00163 }
00164 
00165 ////////////////////////////////////////////////////////////////////
00166 //     Function: PhysxWheelShapeDesc::set_wheel_flag
00167 //       Access: Published
00168 //  Description: Turn the specified wheel shape flag on or off.
00169 ////////////////////////////////////////////////////////////////////
00170 void PhysxWheelShapeDesc::
00171 set_wheel_flag(PhysxWheelShapeFlag flag, bool value) {
00172 
00173   if (value == true) {
00174     _desc.wheelFlags |= flag;
00175   } 
00176   else {
00177     _desc.wheelFlags &= ~(flag);
00178   }
00179 }
00180 
00181 ////////////////////////////////////////////////////////////////////
00182 //     Function: PhysxWheelShapeDesc::get_wheel_flag
00183 //       Access: Published
00184 //  Description: Returns the specified wheel shape flag.
00185 ////////////////////////////////////////////////////////////////////
00186 bool PhysxWheelShapeDesc::
00187 get_wheel_flag(const PhysxWheelShapeFlag flag) const {
00188 
00189   return (_desc.wheelFlags & flag) ? true : false;
00190 }
00191 
00192 ////////////////////////////////////////////////////////////////////
00193 //     Function: PhysxWheelShapeDesc::set_suspension
00194 //       Access: Published
00195 //  Description: Set the data intended for car wheel suspension
00196 //               effects.
00197 ////////////////////////////////////////////////////////////////////
00198 void PhysxWheelShapeDesc::
00199 set_suspension(const PhysxSpringDesc &spring) {
00200 
00201   _desc.suspension = spring._desc;
00202 }
00203 
00204 ////////////////////////////////////////////////////////////////////
00205 //     Function: PhysxWheelShapeDesc::get_suspension
00206 //       Access: Published
00207 //  Description: 
00208 ////////////////////////////////////////////////////////////////////
00209 PhysxSpringDesc PhysxWheelShapeDesc::
00210 get_suspension() const {
00211 
00212   PhysxSpringDesc value;
00213   value._desc = _desc.suspension;
00214   return value;
00215 }
00216 
 All Classes Functions Variables Enumerations