rapier.js icon indicating copy to clipboard operation
rapier.js copied to clipboard

Adjust local anchors of a ball joint

Open Chargeuk opened this issue 3 years ago • 4 comments

Hi, I was wondering if it would be possible to adjust the local_anchor1 and local_anchor2 values of a ball joint after the joint had been created? I have been digging through the code, but do not know the rust language. It seems that the anchors are simply defined within the ball joint class, but I do see that other classes take copies (or references?) to their values. If a method to change the anchors was added to the ball joint, would the changed value be used throughout the system? And then could this method be exposed via the JavaScript interface? Many thanks, Rapier looks like an awesome physics engine.

Chargeuk avatar Dec 30 '21 22:12 Chargeuk

i think you can't modify it after the creation.

jcyuan avatar May 11 '22 11:05 jcyuan

Hi @jcyuan - I did actually locally make this change and it worked fine. However, that was before the large number of changes made by @sebcrozet in version 0.8.x so my changes are not mergeable with the code as it stands. Once 0.8 is out of alpha I will try to make the changes again and open a pull request against the official repo so everyone could benefit (assuming it still works).

Chargeuk avatar May 19 '22 08:05 Chargeuk

Hi @jcyuan - I did actually locally make this change and it worked fine. However, that was before the large number of changes made by @sebcrozet in version 0.8.x so my changes are not mergeable with the code as it stands. Once 0.8 is out of alpha I will try to make the changes again and open a pull request against the official repo so everyone could benefit (assuming it still works).

sounds great~ thanks. (assuming it still works), yep, you could test it first though lol. 👍

jcyuan avatar May 20 '22 13:05 jcyuan

Hi @jcyuan - I've opened a pull request to expose the Rapier methods that change the local anchor points within Rapier.js. I also exposed the method to change the joint limits. Please note that I am in no way a Rust dev, so I hope what I've done is ok. Pull request here: https://github.com/dimforge/rapier.js/pull/149

Chargeuk avatar Jun 27 '22 08:06 Chargeuk