# Spring joint with AmmoJS

**URL:** <https://forum.babylonjs.com/t/spring-joint-with-ammojs/4451>\
**Category:** Questions\
**Created:** [July 12, 2019, 10:28am UTC](https://forum.babylonjs.com/t/spring-joint-with-ammojs/4451 "2019-07-12T10:28:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Spyrou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/spyrou/32/28076_2.png) [@Spyrou](https://forum.babylonjs.com/u/Spyrou)\
**Post date:** [July 12, 2019, 10:28am UTC](https://forum.babylonjs.com/t/spring-joint-with-ammojs/4451/1 "2019-07-12T10:28:23Z")

</div>

Hello,

I’m currently trying to simulate muscles and ligaments. I think the best thing for that are springs.  
In my project, I have a lot of compound bodies with some primary colliders. So I have to use AmmoJS because it’s currently the only engine that can properly handle them.

Ir didn’t find any joint in AmmoJSPlugin where I can change stiffness or damping to create a spring. But the Bullet physics engine has a btGeneric6DofSpringConstraint wich I think I could use.([Bullet Collision Detection & Physics Library: btGeneric6DofSpringConstraint Class Reference](https://pybullet.org/Bullet/BulletFull/classbtGeneric6DofSpringConstraint.html))

I’m not very good in C++ or mixing different frameworks but I find a way to create a spring.

In [https://www.babylonjs-playground.com/#W2KED8#15](https://www.babylonjs-playground.com/#W2KED8#15) , I created a spring joint (line 78) wich seems to be fine at first glance. The two bodies have a constraint. If I move one, the other one follow immediatly.  
But If I want to change the stiffness or the damping of the spring, nothing change. It’s like the constraint is not affected. Changing the mass of the green box or the gravity changes nothing.

Right now, I don’t know where to look to make this work. I also don’t understand the use of indexes in some functions like “springJoint.enableSpring(index,bool)”.

If someone has an idea or see my mistakes ? :).

Thanks for help.

---

<div class="post-metadata">

**Author:** ![Spyrou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/spyrou/32/28076_2.png) [@Spyrou](https://forum.babylonjs.com/u/Spyrou)\
**Post date:** [July 12, 2019, 10:39am UTC](https://forum.babylonjs.com/t/spring-joint-with-ammojs/4451/2 "2019-07-12T10:39:19Z")

</div>

Okey, that was fast, I found xD…

We have to remove the restrictions with

```auto
setLinearLowerLimit
setLinearUpperLimit

```

The indexes are for the axes. “1” is for y-axis.

[https://www.babylonjs-playground.com/#W2KED8#17](https://www.babylonjs-playground.com/#W2KED8#17)

---

<div class="post-metadata">

**Author:** ![rich\_engle](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/rich_engle/32/44879_2.png) [@rich\_engle](https://forum.babylonjs.com/u/rich_engle)\
**Post date:** [February 1, 2025, 3:49am UTC](https://forum.babylonjs.com/t/spring-joint-with-ammojs/4451/3 "2025-02-01T03:49:04Z")

</div>

do you have any updates on this? i am trying to do the same.
