Skip to content

feat: Add frame setter methods for revolute/prismatic joints#370

Open
wkwooten wants to merge 1 commit into
dimforge:masterfrom
wkwooten:feat/joint-frame-setters
Open

feat: Add frame setter methods for revolute/prismatic joints#370
wkwooten wants to merge 1 commit into
dimforge:masterfrom
wkwooten:feat/joint-frame-setters

Conversation

@wkwooten
Copy link
Copy Markdown

Summary

This PR implements the frame transformation capabilities requested in #271, allowing users to set joint frames after joint creation.

Changes

Added four new setter methods to ImpulseJoint:

  • setFrameX1(rotation) - Sets the rotation frame for the first rigid-body attachment
  • setFrameX2(rotation) - Sets the rotation frame for the second rigid-body attachment
  • setLocalFrame1(anchor, rotation) - Sets the full local frame (position + rotation) for the first attachment
  • setLocalFrame2(anchor, rotation) - Sets the full local frame (position + rotation) for the second attachment

These complement the existing frameX1() and frameX2() getters, providing symmetric read/write access to joint frames.

Motivation

Joint frames are currently read-only in the JavaScript bindings despite being settable in the Rust API. This limitation prevents adjustments to joint configurations after creation.

Testing

The implementation delegates directly to Rapier's safe abstractions (set_local_frame1 / set_local_frame2), following the same pattern as existing anchor setters. This has been used in a production application for several months without issues.

Fixes

Fixes #271

This implements the frame transformation capabilities requested in issue dimforge#271,
allowing users to set joint frames after joint creation via:
- setFrameX1() / setFrameX2() for rotation frames
- setLocalFrame1() / setLocalFrame2() for full frame (anchor + rotation)

These methods enable more flexible joint configuration in physics simulations,
particularly for use cases like VistaKine where joint frames need adjustment
after initial setup.

Fixes dimforge#271
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set Frame for Revolute/Prismatic Joints

1 participant