Skip to content

Stand-alone CollisionPipeline doesn't account for changes to bodies #815

@BrettHemes-3M

Description

@BrettHemes-3M

Related to #191 (Stand-alone QueryPipeline doesn't account for changes to bodies)

I am using the CollisionPipeline with colliders attached to parent bodies (with some positional offsets). Upon stepping the pipeline, the respective modified bodies lists are cleared but the actual changed bits of the bodies in the RigidBodySet are not. This prevents the body from ever getting re-added to the modified list upon subsequent changes (i.e., when I update the parent body's position using get_mut).

The blocking check starts here:

pub fn get_mut(&mut self, handle: RigidBodyHandle) -> Option<&mut RigidBody> {

and the modification addition skipped here:
if !rb.changes.contains(RigidBodyChanges::MODIFIED) {

The if check never passes because the modified bits are already set (from never being cleared).

propagate_modified_body_positions_to_colliders doesn't work either due to the above (uses modification list, not changed bits)

The physics pipeline calls is own helpers, clear_modified_colliders and clear_modified_bodies while the CollisionPipeline only calls a single clear_modified_colliders

Should the CollisionPipeline clear the modified body bits? If not, and/or adding a way to clear the changed bits in my RigidBodySet manually would help (not in public API currently).

Workaround

As of right now, I can get the changes to propagate by manually updating the collider positions wrt their parent (to the same value 🙃) every time I move a body like so:

let collider_handle = self.name_collider_map.get(name).unwrap();
let collider = self.colliders.get_mut(*collider_handle).unwrap();
collider.set_position_wrt_parent(*collider.position_wrt_parent().unwrap());

Awesome library btw, thanks for all the hard work 🎉

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions