Forums
SetAngularVelocity in rotationalframe.h - Printable Version

+- Forums (https://www.vdrift.net/Forum)
+-- Forum: Community (https://www.vdrift.net/Forum/forumdisplay.php?fid=3)
+--- Forum: Bugs (https://www.vdrift.net/Forum/forumdisplay.php?fid=7)
+--- Thread: SetAngularVelocity in rotationalframe.h (/showthread.php?tid=1255)



SetAngularVelocity in rotationalframe.h - sebiastisch - 03-02-2010

Sorry for again having to post such a little bug, but the effects can be dramatic.

Please replace
Code:
void SetAngularVelocity(const MATHVECTOR <T, 3> & newangvel)
    {
        angular_momentum = inverse_inertia_tensor.Inverse().Multiply(newangvel);
        RecalculateSecondary();
    }
with

Code:
void SetAngularVelocity(const MATHVECTOR <T, 3> & newangvel)
    {
        angular_momentum = world_inverse_inertia_tensor.Inverse().Multiply(newangvel);
        angular_velocity = newangvel;
    }

To not RecalculateSecondary is just a minor optimation, but what really matters is the world in world_inverse_inertia_tensor

This can lead to a very strange problems, should the function be used somewhere.


- joevenzon - 03-02-2010

Done, R2624.