bevy_xpbd
bevy_xpbd copied to clipboard
Consider lighter "sensor only" use case
trafficstars
Would like to suggest a more focused API when using sensor only colliders/rigidbodies.
Currently when a user is only using colliders for non-simulated scenarios like picking, raycasting, generating navmeshes, etc, the RigidBody and Collider components pull in many others that are irrelevant.
On RigidBody, only Position and Rotation make sense for a static body.
#[require(
// TODO: Only dynamic and kinematic bodies need velocity,
// and only dynamic bodies need mass and angular inertia.
Position::PLACEHOLDER,
Rotation::PLACEHOLDER,
LinearVelocity,
AngularVelocity,
ComputedMass,
ComputedAngularInertia,
ComputedCenterOfMass,
// Required for local forces and acceleration.
AccumulatedLocalAcceleration,
// TODO: We can remove these pre-solve deltas once joints don't use XPBD.
PreSolveDeltaPosition,
PreSolveDeltaRotation,
)]
#[component(immutable, on_add = RigidBody::on_add)]
pub enum RigidBody {
And for a Sensor Collider, ColliderDensity and ColliderMassProperties are not needed either.
#[require(
ColliderMarker,
ColliderAabb,
CollisionLayers,
ColliderDensity,
ColliderMassProperties
)]
pub struct Collider {