Changing physics constraints parameters

Hi,

Is there a way to change some physics constraints after it has been added to the engine? For example, I’m trying to update the distance in the DistanceConstraint with mesh.options.maxDistance. However this only works before adding said constraint.

Thank you

For example on the pendulum demo: https://playground.babylonjs.com/#NAMYYQ#2 Would it be possible to change the distance when an event suck as a keystroke happens?

cc @Cedric

Yes, it should be possible to change the linear min/max using these methods
https://doc.babylonjs.com/typedoc/classes/BABYLON.HavokPlugin#setAxisMinLimit
https://doc.babylonjs.com/typedoc/classes/BABYLON.HavokPlugin#setAxisMaxLimit

It works with provided PG. check line 100

2 Likes

Thank you! This works great, I also applied it to the MinLimit, and applied a small linear velocity on any constraint update. Without applying some kind of force the constraint is updated on the engine but not reflected to the scene.