Prevent Rotation

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Jesseyay
Posts: 4
Joined: Wed May 21, 2008 12:22 pm

Prevent Rotation

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

Re: Prevent Rotation

Post 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!
Jesseyay
Posts: 4
Joined: Wed May 21, 2008 12:22 pm

Re: Prevent Rotation

Post by Jesseyay »

Okay thanks heaps.
Post Reply