Freeze Rotation

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Gam3r GEEk
Posts: 3
Joined: Mon Aug 10, 2009 11:03 pm

Freeze Rotation

Post 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?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Freeze Rotation

Post 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.
Gam3r GEEk
Posts: 3
Joined: Mon Aug 10, 2009 11:03 pm

Re: Freeze Rotation

Post by Gam3r GEEk »

Thanks that should do it.
Post Reply