Making 6DOF constraint spring back to original position

Hi Guys,

I have made a hinge-style joint with the V2 6DOF constraint as follows -

Limited Hinge | Babylon.js Playground (babylonjs.com)

I’d like the hinge to spring back to its original flat position (overcoming gravity), but I can’t figure out how to do that without going way over the top (like putting a gravity force sucking it up constantly).

I have looked at the ‘SpringConstraint’ but that only seems to work in terms of distance and not angularity? Or am I missing something?

Please help - thanks!

TR909

Hello !

I would say there are several ways, but for example, applying a vertical force constantly, instead of on click, does the trick :

(Adding box on click, in order to check the “spring” behavior)
test
:arrow_right: Playground

NB : Quick and dirty since physics should not be applied at render time, because the rate is not guaranted. Should be done in a more constant way such as setInterval, etc…

++ :slight_smile:
Tricotou

1 Like

Thanks!

That does the job, much appreciated -