Page 1 of 1
Freeze Rotation
Posted: Mon Aug 10, 2009 11:06 pm
by Gam3r GEEk
I will just get straight to the question,
how can I stop a object from rotating on the X and Z axis but continue to rotate on the Y?
Re: Freeze Rotation
Posted: Tue Aug 11, 2009 12:00 am
by Norbo
You can set the inverse inertia tensor matrix so that certain axes have essentially infinite inertia, preventing rotation around them. To do what you want specifically:
Code: Select all
Matrix inertiaTensorInverse = box.localSpaceInertiaTensorInverse;
inertiaTensorInverse.M31 = 0;
inertiaTensorInverse.M32 = 0;
inertiaTensorInverse.M33 = 0;
inertiaTensorInverse.M11 = 0;
inertiaTensorInverse.M12 = 0;
inertiaTensorInverse.M13 = 0;
box.localSpaceInertiaTensorInverse = inertiaTensorInverse;
where each row 1 is X, row 2 is Y, and row 3 is Z.
Re: Freeze Rotation
Posted: Tue Aug 11, 2009 5:46 am
by Gam3r GEEk
Thanks that should do it.