Prevent NANs/crash.
This commit is contained in:
parent
e3513b10c6
commit
5619509ebb
@ -975,8 +975,11 @@ void btKart::capSpeed(float max_speed)
|
||||
{
|
||||
const btVector3 &velocity = m_chassisBody->getLinearVelocity();
|
||||
float speed = velocity.length();
|
||||
const float velocity_ratio = max_speed/speed;
|
||||
m_chassisBody->setLinearVelocity( velocity * velocity_ratio);
|
||||
if(speed!=0)
|
||||
{
|
||||
const float velocity_ratio = max_speed / speed;
|
||||
m_chassisBody->setLinearVelocity(velocity * velocity_ratio);
|
||||
}
|
||||
} // capSpeed
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user