SuperTuxKart
|
rayCast vehicle, very special constraint that turn a rigidbody into a vehicle. More...
#include <btKart.hpp>
Classes | |
class | btVehicleTuning |
Public Member Functions | |
btKart (btRigidBody *chassis, btVehicleRaycaster *raycaster, Kart *kart) | |
Constructor to create a car from an existing rigidbody. More... | |
void | reset () |
Resets the kart before a (re)start, to make sure all physics variable are properly defined. More... | |
void | debugDraw (btIDebugDraw *debugDrawer) |
const btTransform & | getChassisWorldTransform () const |
btScalar | rayCast (unsigned int index, float fraction=1.0f) |
virtual void | updateVehicle (btScalar step) |
void | resetSuspension () |
btScalar | getSteeringValue (int wheel) const |
void | setSteeringValue (btScalar steering, int wheel) |
void | applyEngineForce (btScalar force, int wheel) |
const btTransform & | getWheelTransformWS (int wheelIndex) const |
void | updateWheelTransform (int wheelIndex, bool interpolatedTransform=true) |
btWheelInfo & | addWheel (const btVector3 &connectionPointCS0, const btVector3 &wheelDirectionCS0, const btVector3 &wheelAxleCS, btScalar suspensionRestLength, btScalar wheelRadius, const btVehicleTuning &tuning, bool isFrontWheel) |
const btWheelInfo & | getWheelInfo (int index) const |
btWheelInfo & | getWheelInfo (int index) |
void | updateAllWheelTransformsWS () |
Updates all wheel transform informations. More... | |
void | setAllBrakes (btScalar brake) |
void | updateSuspension (btScalar deltaTime) |
virtual void | updateFriction (btScalar timeStep) |
void | setSliding (bool active) |
Enables or disables sliding. More... | |
void | instantSpeedIncreaseTo (btScalar speed) |
void | adjustSpeed (btScalar min_speed, btScalar max_speed) |
Adjusts the velocity of this kart to be at least the specified minimum, and less than or equal to the maximum. More... | |
void | updateAllWheelPositions () |
void | getVisualContactPoint (const btTransform &chassis_trans, btVector3 *left, btVector3 *right) |
Returns the contact point of a visual wheel. More... | |
bool | visualWheelsTouchGround () const |
Returns true if both rear visual wheels touch the ground. More... | |
virtual void | updateAction (btCollisionWorld *collisionWorld, btScalar step) |
btActionInterface interface. More... | |
int | getNumWheels () const |
Returns the number of wheels of this vehicle. More... | |
btRigidBody * | getRigidBody () |
Returns the chassis (rigid) body. More... | |
const btRigidBody * | getRigidBody () const |
Returns the chassis (rigid) body. More... | |
int | getRightAxis () const |
Returns the index of the right axis. More... | |
int | getUpAxis () const |
Returns the index of the up axis. More... | |
int | getForwardAxis () const |
Returns the index of the forward axis. More... | |
int | getUserConstraintType () const |
Backwards compatibility. More... | |
void | setUserConstraintType (int userConstraintType) |
void | setUserConstraintId (int uid) |
int | getUserConstraintId () const |
unsigned int | getNumWheelsOnGround () const |
Returns the number of wheels on the ground. More... | |
void | setTimedCentralImpulse (uint16_t t, const btVector3 &imp, bool rewind=false) |
Sets an impulse that is applied for a certain amount of time. More... | |
uint16_t | getCentralImpulseTicks () const |
Returns the time an additional impulse is activated. More... | |
const btVector3 & | getAdditionalImpulse () const |
void | setTimedRotation (uint16_t t, float rot_in_y_axis) |
Sets a rotation that is applied over a certain amount of time (to avoid a too rapid changes in the kart). More... | |
float | getTimedRotation () const |
uint16_t | getTimedRotationTicks () const |
void | setMaxSpeed (float new_max_speed) |
Sets the maximum speed for this kart. More... | |
virtual void | resetMaxSpeed () |
Resets the maximum so any new maximum value from the application will be accepted. More... | |
void | setMinSpeed (float s) |
Sets the minimum speed for this kart. More... | |
btScalar | getMinSpeed () const |
Returns the minimum speed for this kart. More... | |
Private Member Functions | |
btScalar | calcRollingFriction (btWheelContactPoint &contactPoint) |
void | defaultInit () |
btScalar | rayCast (btWheelInfo &wheel, const btVector3 &ray) |
void | updateWheelTransformsWS (btWheelInfo &wheel, btTransform chassis_trans, bool interpolatedTransform=true, float fraction=1.0f) |
Static Private Member Functions | |
static btRigidBody & | getFixedBody () |
Private Attributes | |
btAlignedObjectArray< btVector3 > | m_forwardWS |
btAlignedObjectArray< btVector3 > | m_axle |
btAlignedObjectArray< btScalar > | m_forwardImpulse |
btAlignedObjectArray< btScalar > | m_sideImpulse |
int | m_userConstraintType |
backwards compatibility | |
int | m_userConstraintId |
btScalar | m_damping |
btVehicleRaycaster * | m_vehicleRaycaster |
bool | m_allow_sliding |
Sliding (skidding) will only be permited when this is true. More... | |
btVector3 | m_additional_impulse |
An additional impulse that is applied for a certain amount of time. More... | |
uint16_t | m_ticks_additional_impulse |
The time the additional impulse should be applied. More... | |
float | m_additional_rotation |
Additional rotation in y-axis that is applied over a certain amount of time. More... | |
uint16_t | m_ticks_additional_rotation |
Duration over which the additional rotation is applied. More... | |
btRigidBody * | m_chassisBody |
The rigid body that is the chassis of the kart. More... | |
btRigidBody | m_fixed_body |
Used to replace the ground object. More... | |
int | m_num_wheels_on_ground |
Number of wheels that touch the ground. More... | |
int | m_indexRightAxis |
Index of the right axis. More... | |
int | m_indexUpAxis |
Index of the up axis. More... | |
int | m_indexForwardAxis |
Index of the forward axis. More... | |
Kart * | m_kart |
The STK kart object which uses this vehicle. More... | |
btScalar | m_min_speed |
Minimum speed for the kart. More... | |
btScalar | m_max_speed |
Maximum speed for the kart. More... | |
bool | m_visual_wheels_touch_ground |
True if the visual wheels touch the ground. More... | |
btAlignedObjectArray< btWheelInfo > | m_wheelInfo |
rayCast vehicle, very special constraint that turn a rigidbody into a vehicle.
btKart::btKart | ( | btRigidBody * | chassis, |
btVehicleRaycaster * | raycaster, | ||
Kart * | kart | ||
) |
Constructor to create a car from an existing rigidbody.
chassis | The rigid body to use as chassis. |
raycaster | The raycast object to use. kart The STK kart object that uses this vehicle (this is used to get access to the kart properties). |
void btKart::adjustSpeed | ( | btScalar | min_speed, |
btScalar | max_speed | ||
) |
Adjusts the velocity of this kart to be at least the specified minimum, and less than or equal to the maximum.
If necessary the kart will instantaneously change its speed.
min_speed | Minimum speed, 0 means no effect. |
max_speed | Maximum speed the kart is allowed to have. |
|
inline |
Returns the time an additional impulse is activated.
|
inline |
Returns the index of the forward axis.
|
inline |
Returns the minimum speed for this kart.
|
inline |
Returns the number of wheels of this vehicle.
|
inline |
Returns the number of wheels on the ground.
|
inline |
Returns the index of the right axis.
|
inline |
Returns the chassis (rigid) body.
|
inline |
Returns the chassis (rigid) body.
|
inline |
Returns the index of the up axis.
|
inline |
Backwards compatibility.
void btKart::getVisualContactPoint | ( | const btTransform & | chassis_trans, |
btVector3 * | left, | ||
btVector3 * | right | ||
) |
Returns the contact point of a visual wheel.
n | Index of the wheel, must be 2 or 3 since only the two rear wheels define the visual position |
btScalar btKart::rayCast | ( | unsigned int | index, |
float | fraction = 1.0f |
||
) |
void btKart::reset | ( | ) |
Resets the kart before a (re)start, to make sure all physics variable are properly defined.
This is especially important for physics replay.
|
inlinevirtual |
Resets the maximum so any new maximum value from the application will be accepted.
|
inline |
Sets the maximum speed for this kart.
|
inline |
Sets the minimum speed for this kart.
void btKart::setSliding | ( | bool | active | ) |
Enables or disables sliding.
active | Enable (true) or disable sliding. |
|
inline |
Sets an impulse that is applied for a certain amount of time.
t | Ticks for the impulse to be active. |
imp | The impulse to apply. |
|
inline |
Sets a rotation that is applied over a certain amount of time (to avoid a too rapid changes in the kart).
t | Ticks for the rotation to be applied. |
rot_in_y_axis | The rotation in y-axis to apply. |
|
inlinevirtual |
btActionInterface interface.
void btKart::updateAllWheelTransformsWS | ( | ) |
Updates all wheel transform informations.
This is used just after a rewind to update all m_hardPointWS (which is used by stk to determine the terrain under the kart).
|
inline |
Returns true if both rear visual wheels touch the ground.
|
private |
An additional impulse that is applied for a certain amount of time.
|
private |
Additional rotation in y-axis that is applied over a certain amount of time.
|
private |
Sliding (skidding) will only be permited when this is true.
Also check the friction parameter in the wheels since friction directly affects skidding.
|
private |
The rigid body that is the chassis of the kart.
|
private |
Used to replace the ground object.
|
private |
Index of the forward axis.
|
private |
Index of the right axis.
|
private |
Index of the up axis.
|
private |
The STK kart object which uses this vehicle.
This is mostly used to get access to the kart properties, which also define physics properties.
|
private |
Maximum speed for the kart.
It is reset to -1 at the end of each physics steps, so need to be set again by the application.
|
private |
Minimum speed for the kart.
Used e.g. for zippers. Setting this value will potentially instantaneously accelerate the kart to the minimum speed requested (in the next physics step).
|
private |
Number of wheels that touch the ground.
|
private |
The time the additional impulse should be applied.
|
private |
Duration over which the additional rotation is applied.
|
private |
True if the visual wheels touch the ground.