Godot Version
4.4.1
Question
I’m dynamically toggling collision for a StaticBody2D by enabling and disabling its CollisionShape2D nodes through their disabled property. (Disabling CollisionLayers won’t work since a bug prevents Godot from clearing existing overlaps.)
When disabling the shapes, everything works as expected — a ShapeCast2D overlapping the body immediately stops detecting it when updated right away by calling force_shapecast_update().
However, when re-enabling the same shapes (disabled = false), the ShapeCast2D does not detect the body again right away. Even if I call force_shapecast_update() (deferred or immediate), the body remains non-collidable for several frames.
By updating the ShapeCast2D every frame and logging collisions, I confirmed that it takes multiple physics frames before the body becomes collidable again. Waiting just one physics frame is not enough.
Is there any reliable workaround?