25 #define ROLLING_INFLUENCE_FIX
36 :m_vehicleRaycaster(raycaster),
125 right[0],fwd[0],up[0],
126 right[1],fwd[1],up[1],
127 right[2],fwd[2],up[2]
157 if (interpolatedTransform && (
getRigidBody()->getMotionState()))
202 btScalar hitDistance = param*raylen;
221 btVector3 chassis_velocity_at_contactPoint;
429 btScalar length_diff = (susp_length - current_length);
440 if ( projected_rel_vel <
btScalar(0.0) )
448 force -= susp_damping * projected_rel_vel;
539 int numWheelsOnGround = 0;
571 wheelBasis0[1][m_indexRightAxis],
572 wheelBasis0[2][m_indexRightAxis]);
576 m_axle[i] -= surfNormalWS * proj;
598 bool sliding =
false;
614 btScalar defaultRollingFrictionImpulse = 0.f;
636 btScalar maximpSquared = maximp * maximpSide;
644 btScalar impulseSquared = (x*x + y*y);
646 if (impulseSquared > maximpSquared)
700 #if defined ROLLING_INFLUENCE_FIX // fix. It only worked if car's up was along Y - VT.
702 rel_pos -= vChassisWorldUp * (vChassisWorldUp.
dot(rel_pos) * (1.f-wheelInfo.
m_rollInfluence));
741 debugDrawer->
drawLine(wheelPosWS,wheelPosWS+axle,wheelColor);
btScalar getInvMass() const
static const btRigidBody * upcast(const btCollisionObject *colObj)
to keep collision detection and dynamics separate we don't store a rigidbody pointer but a rigidbody ...
btTransform m_worldTransform
virtual ~btRaycastVehicle()
btVector3 m_hitNormalInWorld
void setSteeringValue(btScalar steering, int wheel)
void push_back(const T &_Val)
const btTransform & getWheelTransformWS(int wheelIndex) const
btAlignedObjectArray< btScalar > m_sideImpulse
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
virtual void rayTest(const btVector3 &rayFromWorld, const btVector3 &rayToWorld, RayResultCallback &resultCallback) const
rayTest performs a raycast on all objects in the btCollisionWorld, and calls the resultCallback This ...
btVector3 m_wheelDirectionWS
btScalar getSuspensionRestLength() const
btScalar m_suspensionRelativeVelocity
btScalar m_wheelsSuspensionForce
static btRigidBody & getFixedBody()
virtual void * castRay(const btVector3 &from, const btVector3 &to, btVehicleRaycasterResult &result)
btVector3 m_chassisConnectionPointCS
virtual void drawLine(const btVector3 &from, const btVector3 &to, const btVector3 &color)=0
void defaultInit(const btVehicleTuning &tuning)
btScalar m_maxSuspensionTravelCm
btScalar m_currentVehicleSpeedKmHour
btAlignedObjectArray< btWheelInfo > m_wheelInfo
btScalar btSqrt(btScalar y)
const btCollisionObject * m_collisionObject
btScalar m_suspensionRestLength
btVehicleRaycaster * m_vehicleRaycaster
btScalar computeImpulseDenominator(const btVector3 &pos, const btVector3 &normal) const
void applyEngineForce(btScalar force, int wheel)
btScalar m_maxSuspensionForce
void debugDraw(btIDebugDraw *debugDrawer)
btActionInterface interface
btVector3 getColumn(int i) const
Get a column of the matrix as a vector.
btScalar m_suspensionStiffness
btTransform m_worldTransform
btScalar m_closestHitFraction
btScalar dot(const btVector3 &v) const
Return the dot product.
btWheelInfo contains information per wheel about friction and suspension.
bool hasContactResponse() const
virtual void updateVehicle(btScalar step)
btVector3 & normalize()
Normalize this vector x^2 + y^2 + z^2 = 1.
btScalar m_suspensionStiffness
btVector3 getVelocityInLocalPoint(const btVector3 &rel_pos) const
const btTransform & getChassisWorldTransform() const
void btSetMin(T &a, const T &b)
btScalar m_suspensionStiffness
const btWheelInfo & getWheelInfo(int index) const
int size() const
return the number of elements in the array
const btTransform & getCenterOfMassTransform() const
btScalar rayCast(btWheelInfo &wheel)
btVector3 m_wheelDirectionCS
btScalar m_suspensionDamping
btScalar m_wheelsDampingCompression
btVector3 cross(const btVector3 &v) const
Return the cross product between this and another vector.
void updateWheelTransformsWS(btWheelInfo &wheel, bool interpolatedTransform=true)
btScalar sideFrictionStiffness2
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations...
btScalar m_maxSuspensionForce
const btVector3 & getCenterOfMassPosition() const
The btRigidBody is the main class for rigid body objects.
btScalar length() const
Return the length of the vector.
btScalar m_wheelsDampingCompression
void btSetMax(T &a, const T &b)
void updateWheelTransform(int wheelIndex, bool interpolatedTransform=true)
btScalar m_wheelsDampingRelaxation
btVector3 can be used to represent 3D points and vectors.
btScalar m_suspensionCompression
btVector3 m_hitPointInWorld
btRigidBody * getRigidBody()
btScalar m_maxSuspensionTravelCm
btScalar m_wheelsDampingRelaxation
void setMassProps(btScalar mass, const btVector3 &inertia)
virtual void * castRay(const btVector3 &from, const btVector3 &to, btVehicleRaycasterResult &result)=0
RaycastInfo m_raycastInfo
void resize(int newsize, const T &fillData=T())
void updateSuspension(btScalar deltaTime)
btScalar m_clippedInvContactDotSuspension
btRaycastVehicle(const btVehicleTuning &tuning, btRigidBody *chassis, btVehicleRaycaster *raycaster)
btVehicleRaycaster is provides interface for between vehicle simulation and raycasting ...
btVector3 m_wheelDirectionCS
btVector3 m_hitPointWorld
btVector3 m_contactNormalWS
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
btRigidBody * m_chassisBody
btDynamicsWorld * m_dynamicsWorld
btScalar m_maxSuspensionForce
btMotionState * getMotionState()
const btVector3 & getLinearVelocity() const
void applyImpulse(const btVector3 &impulse, const btVector3 &rel_pos)
The btQuaternion implements quaternion to perform linear algebra rotations in combination with btMatr...
btScalar calcRollingFriction(btWheelContactPoint &contactPoint)
btAlignedObjectArray< btScalar > m_forwardImpulse
btAlignedObjectArray< btVector3 > m_axle
void setBrake(btScalar brake, int wheelIndex)
btVector3 m_contactPointWS
virtual void updateFriction(btScalar timeStep)
virtual void getWorldTransform(btTransform &worldTrans) const =0
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
btWheelInfo & addWheel(const btVector3 &connectionPointCS0, const btVector3 &wheelDirectionCS0, const btVector3 &wheelAxleCS, btScalar suspensionRestLength, btScalar wheelRadius, const btVehicleTuning &tuning, bool isFrontWheel)
btAlignedObjectArray< btVector3 > m_forwardWS
btScalar m_suspensionLength
btScalar getSteeringValue(int wheel) const
btVector3 m_hitNormalWorld
btScalar m_maxSuspensionTravelCm
btVector3 m_chassisConnectionCS