Page 1 of 1

Prevent Rotation

Posted: Wed May 21, 2008 12:41 pm
by Jesseyay
Hello.
I want to make a character using a capsule.
I can make the capsule but it always falls over.
Is there anyway to prevent a body from rotating?

Thanks in advance, Jesse.

Btw nice physics engine. Good to see one for C# :D

Re: Prevent Rotation

Posted: Wed May 21, 2008 6:22 pm
by Norbo
You can restrict the rotation of a body around a given axis by setting the corresponding row in the local inertia tensor inverse to zero. For example if you set the first row to 0's, the object will no longer rotate around the local x axis. If you set the entire local inverse inertia tensor to zeroes, it will no longer rotate. This can be set by using the (Entity).localInertiaTensorInverse field.

Another option is to use the UprightConstraint, which is a little more 'wobbly.' There's also a RotationalAxisConstraint.

Thanks for trying it out!

Re: Prevent Rotation

Posted: Thu May 22, 2008 12:31 pm
by Jesseyay
Okay thanks heaps.