Recently I’m working on spring constraint with Ammojs to create a muscle-like behaviour.
With Ammo, I can change the stiffness, damping and linear limits.
(doc: Bullet Collision Detection & Physics Library: btGeneric6DofSpringConstraint Class Reference)
I think the better thing to change to have a good behaviour is the rest length of the spring. If a muscle contract, its length get smaller. It’s also easier to control the length than tweaking the stiffnes which also allow to change the length but with less control.
I created a small playground where I attached a spring between 2 boxes. The spring part start at line 70. I read a post where someone was using setLinearLimits to change the rest length (c++ - What are "frame A" and "frame B" in btGeneric6DofConstraint's constructor for? - Game Development Stack Exchange) . I tried to do the same but I get some strange behaviour. Changing linear limits to get a minimal restlength imply that it’s behave like a rod. I made a rotation to the box to display this. Just uncomment line 108-109.
If someone has an idea on how to change the rest length and have a rubber band behaviour :).
Ammo is definitively not easy to grasp, I hope cannon will support compound body.
Thanks for help.