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!
How to lock rotation of an entity without using Joints?
-
- Posts: 5
- Joined: Fri Nov 20, 2020 11:25 am
Re: How to lock rotation of an entity without using Joints?
To lock rotation, you can set the inverse inertia tensor to all zeroes:
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.
Code: Select all
inertia.InverseInertiaTensor = default;
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.
-
- Posts: 5
- Joined: Fri Nov 20, 2020 11:25 am
Re: How to lock rotation of an entity without using Joints?
Thanks man
We were able to do it by setting the individual rows to zero.
we got the result we wanted.
We were able to do it by setting the individual rows to zero.
we got the result we wanted.