Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Joints as entities #561

Open
Vrixyz opened this issue Jul 11, 2024 · 0 comments
Open

Joints as entities #561

Vrixyz opened this issue Jul 11, 2024 · 0 comments
Labels
A-Integration very bevy specific C-Enhancement New feature or request D-Medium P-Medium

Comments

@Vrixyz
Copy link
Contributor

Vrixyz commented Jul 11, 2024

The current API for (impulse) joints is not idiomatic to ECS:

A body contains its joint data, and contains a reference to its other body. This leads to the following surprises:

  • how to choose which body has the joint data ?
  • we cannot create 2 joints on a same entity, and have to leverage hierarchy to represent multiple impulse joints.
  • API to query joint data is difficult to make ergonomic (see rapier 0.20 feature: RevoluteJoint::angle + more detailed joints enum #530), because data is split between:
    • body1: Entity or other component RigidbodyHandle
    • body2: parent within the component ImpulseJoint.

Suggested change

I suggest moving the ImpulseJoint out of the body, to have a separate entity containing all information: joint data + the linked entities.

This way we could model multiple joints per body and have all joint data available in the same fashion.

To be noted this is also the choice of Avian (see https://docs.rs/avian3d/latest/avian3d/dynamics/solver/joints/struct.FixedJoint.html)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Integration very bevy specific C-Enhancement New feature or request D-Medium P-Medium
Projects
None yet
Development

No branches or pull requests

1 participant