I want to disable or remove a constraint from an object only in specific frames — for example, when the object is not touching the ground anymore.
Is there a recommended way to check this condition during the animation or physics update? And how can I properly disable the constraint at that moment?
Any advice or examples would be very appreciated. Thanks!
Thanks for the reply, but I think I didn’t explain my use case clearly.
I’m not using CharacterController. Instead, I’m using a physics constraint (Physics6DoFConstraint) to control a motorized object (e.g., a wheel).
What I want to do is dynamically remove or disable this constraint under certain conditions, such as:
When the motor speed gets too high
Or when the object is no longer in contact with the ground (it’s in the air)
Is there a recommended way to Properly remove or disable the constraint during the physics update?
I am not suggesting using CC in your case, but there are code snippets which may be useful to detect needed states (ON_GROUND, ON_AIR etc) in your case.
Here is PG example - https://playground.babylonjs.com/#WO0H1U#13