Is it possible to freeze rotation when using unity physics?
in the PhysicsMass component, there’s a float3 field called “InverseInertia”. Set the x, y, and z components to zero to freeze rotation around all axes.
3 Likes
Thanks
I know the answer has been posted, but here was my solution for putting it into a System
public class YourSystem : SystemBase
protected override void OnStartRunning()
{
Entities
.WithBurst()
.ForEach((ref PhysicsMass mass, ref YourData characterData) =>
{
mass.InverseInertia.x = 0;
mass.InverseInertia.z = 0;
}).ScheduleParallel();
base.OnStartRunning();
}
3 Likes