I'm currently trying to get started with a vehicle simulation using Bullet. I want to start with a raycast vehicle and am currently looking at the btRaycastVehicle code. I have some questions about parts of this code and I hope someone can explain the maths and/or physics to me.
First off, there is this code in btRaycastVehicle::rayCast(btWheelInfo& wheel):
Code: Select all
btScalar denominator= wheel.m_raycastInfo.m_contactNormalWS.dot( wheel.m_raycastInfo.m_wheelDirectionWS );
btVector3 chassis_velocity_at_contactPoint;
btVector3 relpos = wheel.m_raycastInfo.m_contactPointWS-getRigidBody()->getCenterOfMassPosition();
chassis_velocity_at_contactPoint = getRigidBody()->getVelocityInLocalPoint(relpos);
btScalar projVel = wheel.m_raycastInfo.m_contactNormalWS.dot( chassis_velocity_at_contactPoint );
if ( denominator >= btScalar(-0.1))
{
wheel.m_suspensionRelativeVelocity = btScalar(0.0);
wheel.m_clippedInvContactDotSuspension = btScalar(1.0) / btScalar(0.1);
}
else
{
btScalar inv = btScalar(-1.) / denominator;
wheel.m_suspensionRelativeVelocity = projVel * inv;
wheel.m_clippedInvContactDotSuspension = inv;
}
Maybe I will find some other parts that are unclear to me. But for now, it would be great if someone could enlighten me on this one.
Thanks in advance!