Attenuate "yawing" speed when leaving the ground (jumps). Suggested by hiker,
with some tweaks by me (make it 25% per update instead of abrupt zeroing). git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5076 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
92ca36cac5
commit
daa2c467b3
@ -678,6 +678,21 @@ void Kart::update(float dt)
|
||||
else
|
||||
m_uprightConstraint->setLimit(m_kart_properties->getUprightTolerance());
|
||||
|
||||
// TODO: hiker said this probably will be moved to btKart or so when updating bullet engine.
|
||||
// Neutralize any yaw change if the kart leaves the ground, so the kart falls more or less
|
||||
// straight after jumping, but still allowing some "boat shake" (roll and pitch).
|
||||
// Otherwise many non perfect jumps end in a total roll over or a serious change of
|
||||
// direction, sometimes 90 or even full U turn (real but less fun for a karting game).
|
||||
// As side effect steering becames a bit less responsive (any wheel on air), but not too bad.
|
||||
if(!isOnGround()) {
|
||||
btVector3 speed = m_body->getAngularVelocity();
|
||||
speed.setY(speed.getY() * 0.25f); // Progressive attenuation
|
||||
m_body->setAngularVelocity(speed);
|
||||
// This one keeps the kart pointing "100% as launched" instead,
|
||||
// like in ski jump sports, too boring but also works.
|
||||
//m_body->setAngularVelocity(btVector3(0,0,0));
|
||||
}
|
||||
|
||||
m_zipper_time_left = m_zipper_time_left>0.0f ? m_zipper_time_left-dt : 0.0f;
|
||||
|
||||
//m_wheel_rotation gives the rotation around the X-axis, and since velocity's
|
||||
|
Loading…
Reference in New Issue
Block a user