Panda3D
|
A special shape used for simulating a car wheel. More...
#include "physxWheelShape.h"
Public Member Functions | |
virtual TypeHandle | force_init_type () |
float | get_axle_speed () const |
Retrieves the current axle rotation speed. | |
float | get_brake_torque () const |
Must be nonnegative. | |
float | get_inverse_wheel_mass () const |
Returns the inverse mass of the wheel. | |
float | get_motor_torque () const |
Retrieves the sum engine torque on the wheel axle. | |
float | get_radius () const |
Returns the radius of the sphere. | |
float | get_steer_angle () const |
Retrieves the steering angle, around shape Y axis. | |
float | get_steer_angle_rad () const |
Retrieves the steering angle, around shape Y axis. | |
float | get_suspension_travel () const |
Returns the suspension travel. | |
virtual TypeHandle | get_type () const |
bool | get_wheel_flag (PhysxWheelShapeFlag flag) const |
Returns the value of the specified wheel shape flag. | |
void | link (NxShape *shapePtr) |
NxShape * | ptr () const |
void | save_to_desc (PhysxWheelShapeDesc &shapeDesc) const |
Saves the state of the shape object to a descriptor. | |
void | set_axle_speed (float speed) |
Set the current axle rotation speed. | |
void | set_brake_torque (float torque) |
Must be nonnegative. | |
void | set_inverse_wheel_mass (float invMass) |
Set the inverse mass of the wheel. | |
void | set_motor_torque (float torque) |
Set the sum engine torque on the wheel axle. | |
void | set_radius (float radius) |
Sets the sphere radius. | |
void | set_steer_angle (float angle) |
Set the steering angle, around shape Y axis. | |
void | set_steer_angle_rad (float angle) |
Set the steering angle, around shape Y axis. | |
void | set_suspension (const PhysxSpringDesc &spring) |
Set the data intended for car wheel suspension effects. | |
void | set_suspension_travel (float travel) |
Set the maximum extension distance of suspension along shape's -Y axis. | |
void | set_wheel_flag (PhysxWheelShapeFlag flag, bool value) |
Turns the specified wheel shape flag on or off. | |
void | unlink () |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
This function is declared non-inline to work around a compiler bug in g++ 2.96. |
A special shape used for simulating a car wheel.
The -Y axis should be directed toward the ground.
A ray is cast from the shape's origin along the -Y axis. When the ray strikes something, and the distance is:
Thus at the point of greatest possible suspension compression the wheel axle will pass through at the shape's origin. At the point greatest suspension extension the wheel axle will be a distance of suspensionTravel from the shape's origin.
The suspension's targetValue is 0 for real cars, which means that the suspension tries to extend all the way. Otherwise one can specify values [0,1] for suspensions which have a spring to pull the wheel up when it is extended too far. 0.5 will then fall halfway along suspensionTravel.
The +Z axis is the 'forward' direction of travel for the wheel. -Z is backwards. The wheel rolls forward when rotating around the positive direction around the X axis.
A positive wheel steering angle corresponds to a positive rotation around the shape's Y axis. (Castor angles are not modeled.)
The coordinate frame of the shape is rigidly fixed on the car.
Definition at line 69 of file physxWheelShape.h.
float PhysxWheelShape::get_axle_speed | ( | ) | const |
Retrieves the current axle rotation speed.
Definition at line 267 of file physxWheelShape.cxx.
float PhysxWheelShape::get_brake_torque | ( | ) | const |
Must be nonnegative.
Very large values should lock wheel but should be stable.
Definition at line 189 of file physxWheelShape.cxx.
float PhysxWheelShape::get_inverse_wheel_mass | ( | ) | const |
Returns the inverse mass of the wheel.
Determines the wheel velocity that wheel torques can achieve.
Definition at line 137 of file physxWheelShape.cxx.
float PhysxWheelShape::get_motor_torque | ( | ) | const |
Retrieves the sum engine torque on the wheel axle.
Positive or negative depending on direction
Definition at line 163 of file physxWheelShape.cxx.
float PhysxWheelShape::get_radius | ( | ) | const |
Returns the radius of the sphere.
Definition at line 85 of file physxWheelShape.cxx.
float PhysxWheelShape::get_steer_angle | ( | ) | const |
Retrieves the steering angle, around shape Y axis.
The steering angle is measured in degrees.
Definition at line 215 of file physxWheelShape.cxx.
float PhysxWheelShape::get_steer_angle_rad | ( | ) | const |
Retrieves the steering angle, around shape Y axis.
The steering angle is measured in radians.
Definition at line 241 of file physxWheelShape.cxx.
float PhysxWheelShape::get_suspension_travel | ( | ) | const |
Returns the suspension travel.
Definition at line 111 of file physxWheelShape.cxx.
bool PhysxWheelShape::get_wheel_flag | ( | PhysxWheelShapeFlag | flag | ) | const |
Returns the value of the specified wheel shape flag.
Definition at line 300 of file physxWheelShape.cxx.
static void PhysxWheelShape::init_type | ( | ) | [inline, static] |
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Making it inline seems to cause problems in the optimizer.
Reimplemented from PhysxShape.
Definition at line 113 of file physxWheelShape.h.
References PhysxShape::init_type().
void PhysxWheelShape::save_to_desc | ( | PhysxWheelShapeDesc & | shapeDesc | ) | const |
Saves the state of the shape object to a descriptor.
Definition at line 61 of file physxWheelShape.cxx.
void PhysxWheelShape::set_axle_speed | ( | float | speed | ) |
Set the current axle rotation speed.
Note: WSF_axle_speed_override flag must be raised for this to have effect!
Definition at line 255 of file physxWheelShape.cxx.
void PhysxWheelShape::set_brake_torque | ( | float | torque | ) |
Must be nonnegative.
Very large values should lock wheel but should be stable.
Definition at line 176 of file physxWheelShape.cxx.
void PhysxWheelShape::set_inverse_wheel_mass | ( | float | invMass | ) |
Set the inverse mass of the wheel.
Determines the wheel velocity that wheel torques can achieve.
Definition at line 124 of file physxWheelShape.cxx.
void PhysxWheelShape::set_motor_torque | ( | float | torque | ) |
Set the sum engine torque on the wheel axle.
Positive or negative depending on direction
Definition at line 150 of file physxWheelShape.cxx.
void PhysxWheelShape::set_radius | ( | float | radius | ) |
Sets the sphere radius.
Definition at line 73 of file physxWheelShape.cxx.
void PhysxWheelShape::set_steer_angle | ( | float | angle | ) |
Set the steering angle, around shape Y axis.
The steering angle is measured in degrees.
Definition at line 202 of file physxWheelShape.cxx.
void PhysxWheelShape::set_steer_angle_rad | ( | float | angle | ) |
Set the steering angle, around shape Y axis.
The steering angle is measured in radians.
Definition at line 228 of file physxWheelShape.cxx.
void PhysxWheelShape::set_suspension | ( | const PhysxSpringDesc & | spring | ) |
Set the data intended for car wheel suspension effects.
Definition at line 313 of file physxWheelShape.cxx.
void PhysxWheelShape::set_suspension_travel | ( | float | travel | ) |
Set the maximum extension distance of suspension along shape's -Y axis.
The minimum extension is always 0.
Definition at line 99 of file physxWheelShape.cxx.
void PhysxWheelShape::set_wheel_flag | ( | PhysxWheelShapeFlag | flag, |
bool | value | ||
) |
Turns the specified wheel shape flag on or off.
Definition at line 279 of file physxWheelShape.cxx.