rapier icon indicating copy to clipboard operation
rapier copied to clipboard

Stand-alone QueryPipeline doesn't account for changes to bodies

Open Ralith opened this issue 3 years ago • 5 comments

When using a QueryPipeline without any physics, e.g. for querying against world whose state is only updated with calls to RigidBody::set_position, the set_position calls are not accounted for. It looks like this is due to RigidBodySet::handle_user_changes and ColliderSet::handle_user_changes, and perhaps other similar functionality, never getting invoked. Normally these are invoked by PhysicsPipeline::step, but this is painful to invoke when no physics is desired. Unfortunately the critical calls are private to the crate, which leaves the user with little choice.

Ralith avatar May 23 '21 03:05 Ralith

Hi! Ultimately, I think that I would like the QueryPipeline to be moved to parry, and therefore to completely ignore the existence of rigid-bodies. You can update the collider’s position based on their parent rigid-body manually before updating the query pipeline. Maybe we could expose a method from RigidBodySet that would take care of that update for all the modified colliders for you.

sebcrozet avatar Jun 03 '21 19:06 sebcrozet

Working directly in terms of colliders is an easy workaround then, thanks! This isn't a pressing issue for me yet, but is there a plan to support the swept query modes in that case, since those currently depend on information in the rigid body?

Ralith avatar Jun 03 '21 19:06 Ralith

is there a plan to support the swept query modes in that case, since those currently depend on information in the rigid body?

Yeah, that will have to be supported. That’s one of the things I need to figure out before moving the QueryPipeline over to parry.

sebcrozet avatar Jun 03 '21 20:06 sebcrozet

For other folks running into this, this feature was implemented as RigidBodySet::propagate_modified_body_positions_to_colliders.

LPGhatguy avatar Sep 15 '22 06:09 LPGhatguy

Yep, this is biting me right now in RapierJS. Adding colliders to the world requires step() to be called, otherwise they don't show up in intersection queries. Can anyone see a workaround?

Edit: With help from Discord server just found out that world.queryPipeline.update(world.islands, world.bodies, world.colliders) resolves my issue. Newly created colliders get picked up by queries

YarekTyshchenko avatar Jan 11 '23 18:01 YarekTyshchenko