Open Vrixyz opened 4 months ago
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:
Entity
RigidbodyHandle
parent
ImpulseJoint
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)
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:
Entity
or other componentRigidbodyHandle
parent
within the componentImpulseJoint
.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)