#Rigidbody Constraints in DOTS Physics.
1 messages · Page 1 of 1 (latest)
You can add a LimitDOFJoint from the custom physics authoring you can get from the unity physics package manager
otherwise a solution that worked better for me was just simply setting specific physics velocities in a system
like so:
[UpdateInGroup(typeof(BeforePhysicsSystemGroup))]
partial struct Physics2DConstrainSystem : ISystem
{
[BurstCompile] public void OnCreate(ref SystemState state) => state.Require<Physics2DTag>();
[BurstCompile]
public void OnUpdate(ref SystemState state)
{
foreach (var (velocity, transform) in SystemAPI.Query<RefRW<PhysicsVelocity>, RefRW<LocalTransform>>().WithAll<Simulate, Physics2DTag>())
{
velocity.ValueRW.Linear.z = 0;
transform.ValueRW.Position.z = 0;
velocity.ValueRW.Angular.x = 0;
velocity.ValueRW.Angular.y = 0;
transform.ValueRW.Rotation.value.x = 0;
transform.ValueRW.Rotation.value.y = 0;
}
}
}
Not the most elegant solution but it does work
Thank you @scarlet patio !