Dynamically changing joint properties

Hello,

I have a simple scene where I need to change the maxDistance property of a joint by pressing a button dynamically after I attach this joint to the objects. There’s a method for Joint object called as joint.updateDistance(), but when I do that, the connected object goes straight in the center of main object.

heres the link to playground: https://playground.babylonjs.com/#FRJ0A4#1

(notice that I am using ‘m’ key to change the distance property of joint)

what am I doing wrong??

@RaananW or @Cedric may be able to help.

1 Like

Hi!

You are changing the distance joint to be 0.2 units long, which is practically inside the sphere. if you change it to 2 or 1.5 the box will be visible:

https://playground.babylonjs.com/#FRJ0A4#2

3 Likes

Wow, that was really silly of me. Instead of decrementing the distance by 0.2, I set it to 0.2.
Thanks for pointing that out. And sorry for the silly question

all good, we all do that all the time :slight_smile:

1 Like