Hi,
Problem: I simply want to freeze the z position of my PhysicsBody in ecs/dots… like in usual Rigidbody Constraints Freeze Position Z
public partial struct ConstraintZVelocitySystem : ISystem
{
[BurstCompile]
public void OnUpdate(ref SystemState state)
{
foreach (var (velocity, mass)
in SystemAPI.Query<RefRW<PhysicsVelocity>, RefRO<PhysicsMass>>())
{
var vel = velocity.ValueRW.Linear;
vel.z = 0f;
velocity.ValueRW.Linear = vel;
// velocity = float3.zero;
}
}
}
This simply does not work correctly I mean even if I just set the velocity to 0 the PhysicsBody keeps moving / “floating”
I could not figure it out even though searching for older answers because somehow nothing worked for >v1.0
Please help…
Thanks!