dimforge / rapier

2D and 3D physics engines focused on performance.
https://rapier.rs
Apache License 2.0
3.89k stars 242 forks source link

Feature request: Expose local_frame on Spherical Joints #453

Closed luxalpa closed 1 year ago

luxalpa commented 1 year ago

You can currently set local_frame on FixedJoints but not on other joint types as far as I see.

I use spherical joints with joint motors in order to make the pose physically animate into its rest pose (I'm using this for procedural animation on a character). With local_frame I was able to set the joint motors to 0 for this behavior, which in turn allowed me to specify the strength of the muscle on my character at that joint. This is incredibly useful, as it allows me to use separate values for stiffness and damping per axis (so for example I can softlock the ankle joint to primarily rotate around X, and have only very little rotation around the other 2 axes). It also circumvents the issue from #451 as the joint motors are at 0 and have a much easier time targeting values close to 0 instead of a complicated rotation by large values around multiple axes at the same time.

I was able to reach my goal by adjusting the GenericJoint directly and setting local_frame on it, but it would be nice if it was officially supported in the SphericalJoint constructor / builder.