Panda3D
physxWheelShapeDesc.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 physxWheelShapeDesc.cxx
10  * @author enn0x
11  * @date 2009-11-09
12  */
13 
14 #include "physxWheelShapeDesc.h"
15 
16 /**
17  * (re)sets the structure to the default.
18  */
21 
22  _desc.setToDefault();
23  set_name("");
24 
25  _desc.localPose = PhysxManager::mat4_to_nxMat34(LMatrix4f::y_to_z_up_mat());
26 }
27 
28 /**
29  * Radius of shape. Must be positive.
30  */
32 set_radius(float radius) {
33 
34  _desc.radius = radius;
35 }
36 
37 /**
38  * Radius of shape.
39  */
41 get_radius() const {
42 
43  return _desc.radius;
44 }
45 
46 /**
47  * Set the maximum extension distance of suspension along shape's -Y axis.
48  */
50 set_suspension_travel(float suspensionTravel) {
51 
52  _desc.suspensionTravel = suspensionTravel;
53 }
54 
55 /**
56  *
57  */
58 float PhysxWheelShapeDesc::
59 get_suspension_travel() const {
60 
61  return _desc.suspensionTravel;
62 }
63 
64 /**
65  * Set the inverse mass of the wheel.
66  */
68 set_inverse_wheel_mass(float inverseWheelMass) {
69 
70  _desc.inverseWheelMass = inverseWheelMass;
71 }
72 
73 /**
74  *
75  */
76 float PhysxWheelShapeDesc::
77 get_inverse_wheel_mass() const {
78 
79  return _desc.inverseWheelMass;
80 }
81 
82 /**
83  * Set the sum engine torque on the wheel axle.
84  */
86 set_motor_torque(float motorTorque) {
87 
88  _desc.motorTorque = motorTorque;
89 }
90 
91 /**
92  *
93  */
94 float PhysxWheelShapeDesc::
95 get_motor_torque() const {
96 
97  return _desc.motorTorque;
98 }
99 
100 /**
101  * Set the amount of torque applied for braking.
102  */
104 set_brake_torque(float brakeTorque) {
105 
106  _desc.brakeTorque = brakeTorque;
107 }
108 
109 /**
110  *
111  */
112 float PhysxWheelShapeDesc::
113 get_brake_torque() const {
114 
115  return _desc.brakeTorque;
116 }
117 
118 /**
119  * Set the steering angle, around shape Y axis. The steering angle is
120  * measured in degrees.
121  */
123 set_steer_angle(float steerAngle) {
124 
125  _desc.steerAngle = NxMath::degToRad(steerAngle);
126 }
127 
128 /**
129  *
130  */
131 float PhysxWheelShapeDesc::
132 get_steer_angle() const {
133 
134  return _desc.steerAngle;
135 }
136 
137 /**
138  * Turn the specified wheel shape flag on or off.
139  */
141 set_wheel_flag(PhysxWheelShapeFlag flag, bool value) {
142 
143  if (value == true) {
144  _desc.wheelFlags |= flag;
145  }
146  else {
147  _desc.wheelFlags &= ~(flag);
148  }
149 }
150 
151 /**
152  * Returns the specified wheel shape flag.
153  */
155 get_wheel_flag(const PhysxWheelShapeFlag flag) const {
156 
157  return (_desc.wheelFlags & flag) ? true : false;
158 }
159 
160 /**
161  * Set the data intended for car wheel suspension effects.
162  */
165 
166  _desc.suspension = spring._desc;
167 }
168 
169 /**
170  *
171  */
172 PhysxSpringDesc PhysxWheelShapeDesc::
173 get_suspension() const {
174 
175  PhysxSpringDesc value;
176  value._desc = _desc.suspension;
177  return value;
178 }
void set_inverse_wheel_mass(float inverseWheelMass)
Set the inverse mass of the wheel.
void set_suspension_travel(float suspensionTravel)
Set the maximum extension distance of suspension along shape's -Y axis.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Describes a joint spring.
void set_to_default()
(re)sets the structure to the default.
static NxMat34 mat4_to_nxMat34(const LMatrix4f &m)
Converts from LMatrix4f to NxMat34.
Definition: physxManager.I:119
void set_brake_torque(float brakeTorque)
Set the amount of torque applied for braking.
void set_motor_torque(float motorTorque)
Set the sum engine torque on the wheel axle.
void set_radius(float radius)
Radius of shape.
float get_radius() const
Radius of shape.
void set_steer_angle(float steerAngle)
Set the steering angle, around shape Y axis.
void set_name(const char *name)
Sets a possible debug name.
bool get_wheel_flag(PhysxWheelShapeFlag flag) const
Returns the specified wheel shape flag.
void set_suspension(const PhysxSpringDesc &spring)
Set the data intended for car wheel suspension effects.
void set_wheel_flag(PhysxWheelShapeFlag flag, bool value)
Turn the specified wheel shape flag on or off.