How to lock rotation of an entity without using Joints?

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
UmairAndTalha
Posts: 5
Joined: Fri Nov 20, 2020 11:25 am

How to lock rotation of an entity without using Joints?

Post by UmairAndTalha »

Hi there,
I am trying to implement a Rigid-body system in which I can lock any axis rotation or position whenever required. Is there any way to lock the entities rotation in X and Y and position in Z-axis only without using a joint. as it is a single entity!
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: How to lock rotation of an entity without using Joints?

Post by Norbo »

To lock rotation, you can set the inverse inertia tensor to all zeroes:

Code: Select all

inertia.InverseInertiaTensor = default;
You can technically lock individual rows in the tensor by setting them to zero too. Be wary, this can result in unsolvable constraints sometimes. A single body constraint that used the relevant angular degrees of freedom would be the primary cause of this. If such a constraint is added, it might spew NaNs and crash the simulation.

There is no equivalent for locking position components without constraints.

Note that you can create shapeless kinematic bodies to connect the two body constraints to. That would be the more flexible approach.
UmairAndTalha
Posts: 5
Joined: Fri Nov 20, 2020 11:25 am

Re: How to lock rotation of an entity without using Joints?

Post by UmairAndTalha »

Thanks man
We were able to do it by setting the individual rows to zero.
we got the result we wanted.
:D
Post Reply