How can I set translation limits to the SliderJoint in OimoJS physics plugin?

I’m using a SliderJoint (in OimoJS physics plugin) between a sphere and a box number 2 (see image), box number 1 is fixed and box 2 rotates around box 1 (HingeJoint). That works perfectly and I can control the angle of rotation. However, the problem is that the translation of the sphere does not have any limits. The sphere is supposed to move horizontally from point A to point B continuously as I change the angle of rotation of ball number 2, so I want to constraint the SliderJoint so the translation of the sphere can have a minimum and a maximum value (distance). And I don’t want the sphere to rotate.

Certain things are not supported natively in Babylon, but if you know the engine you are using you can pass any parameters using the nativeParams object when constructing the joint/constraint.

1 Like