Jondolf / avian

ECS-driven 2D and 3D physics engine for the Bevy game engine.
https://crates.io/crates/avian3d
Apache License 2.0
1.55k stars 120 forks source link

Position of compound collider seems to be randomly ignored #562

Open tliron opened 1 week ago

tliron commented 1 week ago

This is a difficult one to explain!

Avian 0.1.2 2D. I am attaching this collider to a rigid body and sprite:

Collider::compound(vec![(
    Position(Vec2::new(0., 19.)),
    Rotation::default(),
    Collider::capsule(12., 12.),
)])

Most of the time when I start my game, it is correct. But 10% of the time (?!) it seems the position is ignored and the collider capsule collider appears at 0,0. Even stranger is that once I explicitly move the entity, the capsule "snaps" to its correct location. (It also moves by itself, via gravity, but that doesn't trigger the "snap" to place.) I'm using PhysicsDebugPlugin to see it.

I'm really stumped with debugging this issue, because it cannot be reproduced reliably. It only happens sometimes.

Any suggestion on where to look to try to understand why this is happening? My guess is that it might have something to do with the SyncPlugin.