Dynamic Chain in bones with CANNON JS inside Meta Spark AR with JavaScript

Hello Creators, recently I started learning Javascript, I started from learning physics with cannon because I’m fascinated with the idea of real time physics. But I’m struggling with one thing:

I’m usign the lock constraint to make a kind of “chain” of objects (similar to the dynamic chain on effect house) and it worked pretty well with a bunch of default cubes, but I would like to apply this on a chain of bones but isn’t working properly. I tried a lot of techniques, but when I apply the position of chain colliders to the bones ever get messed up.

The way I found to avoid this “glitch(?)” was getting the worldPos of cubes, because everytime I tried to set the worldPos of bones based on colliders position I got an error message saying that “is only a getter not a setter”

Appreciate your help, thanks!

script cannon js spring.zip (1.6 KB)

I forgot to say one thing about it:

THIS WAY IS GOOD BUT THE FILTER IS LAGGING AF. I think it’s because its doing too much unnecessary calculations. Other thing: I also have to smooth the weight painting inside blender lol.