15 #include "bulletWheel.h" 23 BulletWheel(btWheelInfo &info) : _info(info) {
32 BulletWheelRaycastInfo::
33 BulletWheelRaycastInfo(btWheelInfo::RaycastInfo &info) : _info(info) {
43 get_raycast_info()
const {
57 return (PN_stdfloat)_info.getSuspensionRestLength();
68 _info.m_suspensionStiffness = (btScalar)value;
79 return (PN_stdfloat)_info.m_suspensionStiffness;
91 _info.m_maxSuspensionTravelCm = (btScalar)value;
99 PN_stdfloat BulletWheel::
100 get_max_suspension_travel_cm()
const {
102 return (PN_stdfloat)_info.m_maxSuspensionTravelCm;
113 _info.m_frictionSlip = (btScalar)value;
124 return (PN_stdfloat)_info.m_frictionSlip;
136 _info.m_maxSuspensionForce = (btScalar)value;
148 return (PN_stdfloat)_info.m_maxSuspensionForce;
160 _info.m_wheelsDampingCompression = (btScalar)value;
172 return (PN_stdfloat)_info.m_wheelsDampingCompression;
184 _info.m_wheelsDampingRelaxation = (btScalar)value;
196 return (PN_stdfloat)_info.m_wheelsDampingRelaxation;
211 _info.m_rollInfluence = (btScalar)value;
223 return (PN_stdfloat)_info.m_rollInfluence;
234 _info.m_wheelsRadius = (btScalar)value;
245 return (PN_stdfloat)_info.m_wheelsRadius;
256 _info.m_steering = (btScalar)value;
267 return (PN_stdfloat)_info.m_steering;
276 set_rotation(PN_stdfloat value) {
278 _info.m_rotation = (btScalar)value;
286 PN_stdfloat BulletWheel::
287 get_rotation()
const {
289 return (PN_stdfloat)_info.m_rotation;
298 set_delta_rotation(PN_stdfloat value) {
300 _info.m_deltaRotation = (btScalar)value;
308 PN_stdfloat BulletWheel::
309 get_delta_rotation()
const {
311 return (PN_stdfloat)_info.m_deltaRotation;
323 _info.m_engineForce = (btScalar)value;
335 return (PN_stdfloat)_info.m_engineForce;
344 set_brake(PN_stdfloat value) {
346 _info.m_brake = (btScalar)value;
358 return (PN_stdfloat)_info.m_brake;
367 set_skid_info(PN_stdfloat value) {
369 _info.m_skidInfo = (btScalar)value;
377 PN_stdfloat BulletWheel::
378 get_skid_info()
const {
380 return (PN_stdfloat)_info.m_skidInfo;
389 set_wheels_suspension_force(PN_stdfloat value) {
391 _info.m_wheelsSuspensionForce = (btScalar)value;
399 PN_stdfloat BulletWheel::
400 get_wheels_suspension_force()
const {
402 return (PN_stdfloat)_info.m_wheelsSuspensionForce;
411 set_suspension_relative_velocity(PN_stdfloat value) {
413 _info.m_suspensionRelativeVelocity = (btScalar)value;
421 PN_stdfloat BulletWheel::
422 get_suspension_relative_velocity()
const {
424 return (PN_stdfloat)_info.m_suspensionRelativeVelocity;
433 set_clipped_inv_connection_point_cs(PN_stdfloat value) {
435 _info.m_clippedInvContactDotSuspension = (btScalar)value;
443 PN_stdfloat BulletWheel::
444 get_clipped_inv_connection_point_cs()
const {
446 return (PN_stdfloat)_info.m_clippedInvContactDotSuspension;
459 _info.m_chassisConnectionPointCS = LVecBase3_to_btVector3(pos);
471 return btVector3_to_LPoint3(_info.m_chassisConnectionPointCS);
484 _info.m_wheelDirectionCS = LVecBase3_to_btVector3(dir);
496 return btVector3_to_LVector3(_info.m_wheelDirectionCS);
508 _info.m_wheelAxleCS = LVecBase3_to_btVector3(axle);
519 return btVector3_to_LVector3(_info.m_wheelAxleCS);
528 set_world_transform(
const LMatrix4 &mat) {
531 _info.m_worldTransform = LMatrix4_to_btTrans(mat);
540 get_world_transform()
const {
542 return btTrans_to_LMatrix4(_info.m_worldTransform);
553 _info.m_bIsFrontWheel = value;
564 return _info.m_bIsFrontWheel;
576 _info.m_clientInfo = (
void *)node;
589 return (_info.m_clientInfo == NULL) ? NULL : (
PandaNode *)_info.m_clientInfo;
void set_wheel_direction_cs(const LVector3 &dir)
Sets the wheel's forward vector.
A basic node of the scene graph or data graph.
PN_stdfloat get_suspension_stiffness() const
Returns the stiffness of the suspension.
PN_stdfloat get_engine_force() const
Returns the amount of accelleration force currently applied.
PN_stdfloat get_suspension_rest_length() const
Returns the length of the suspension when the vehicle is standing still.
void set_wheel_axle_cs(const LVector3 &axle)
Determines the wheel axle normal vector.
void set_chassis_connection_point_cs(const LPoint3 &pos)
Sets the point where the wheel is connected to the chassis.
void set_engine_force(PN_stdfloat value)
Defines how much force should be used to rotate the wheel.
void set_steering(PN_stdfloat value)
Sets the steering angle.
LVector3 get_wheel_direction_cs() const
Returns the wheel's forward vector relative to the chassis.
PN_stdfloat get_wheels_damping_relaxation() const
Returns the damping applied to the relaxing suspension.
void set_wheel_radius(PN_stdfloat value)
Sets the wheel radius.
LVector3 get_wheel_axle_cs() const
Returns the normal vector of the wheel axle.
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
PN_stdfloat get_wheels_damping_compression() const
Returns the damping applied to the compressing suspension.
void set_max_suspension_travel_cm(PN_stdfloat value)
Sets the maximum distance the suspension can travel out of the resting position in centimeters...
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
bool is_nan() const
Returns true if any component of the vector is not-a-number, false otherwise.
PN_stdfloat get_brake() const
Returns the amount of braking force currently applied.
bool is_nan() const
Returns true if any component of the matrix is not-a-number, false otherwise.
void set_suspension_stiffness(PN_stdfloat value)
Sets how stiff the suspension shall be.
PN_stdfloat get_friction_slip() const
Returns how slippery the tyres are.
void set_roll_influence(PN_stdfloat value)
Defines a scaling factor for roll forces that affect the chassis.
void set_max_suspension_force(PN_stdfloat value)
Sets the maximum suspension force the wheel can handle.
void set_friction_slip(PN_stdfloat value)
Sets the slipperyness of the tyre.
This is a 4-by-4 transform matrix.
void set_front_wheel(bool value)
Sets if the wheel is steerable.
void set_wheels_damping_relaxation(PN_stdfloat value)
Sets the damping forces applied when the suspension relaxes.
void set_node(PandaNode *node)
Sets the PandaNode which representates the visual appearance of this wheel.
void set_wheels_damping_compression(PN_stdfloat value)
Sets the damping forces applied when the suspension gets compressed.
bool is_front_wheel() const
Determines if a wheel is steerable.
PN_stdfloat get_roll_influence() const
Returns the factor by which roll forces are scaled.
PN_stdfloat get_steering() const
Returns the steering angle in degrees.
LPoint3 get_chassis_connection_point_cs() const
Returns the point where the wheel is connected to the chassis.
PandaNode * get_node() const
Returns the PandaNode which representates the visual appearance of this wheel, if such a representati...
PN_stdfloat get_max_suspension_force() const
Returns the maximum force (weight) the suspension can handle.
PN_stdfloat get_wheel_radius() const
Returns the wheel radius.