-
-
Notifications
You must be signed in to change notification settings - Fork 274
Open
Labels
A-Integrationvery bevy specificvery bevy specificC-EnhancementNew feature or requestNew feature or requestD-MediumP-Medium
Description
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:
Entityor other componentRigidbodyHandle - body2:
parentwithin the componentImpulseJoint.
- body1:
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)
Metadata
Metadata
Assignees
Labels
A-Integrationvery bevy specificvery bevy specificC-EnhancementNew feature or requestNew feature or requestD-MediumP-Medium