I have two KinematicBody2Ds, call them left and right box. They are touching, or nearly touching, at the beginning of the frame. I want to move both boxes to the left by 1 unit in the same frame, but right box is colliding with left box even though I moved left box first. They're being moved with move_and_colide(Vector2(-1,0))
.
I thought, at first, they were being moved in the wrong order (right then left, instead of left then right), so as a test I'm moving them from the same script where I can precisely control the sequence of events. Even though I'm moving the left box to the left, then the right box to the left in that order, the right box still hits the left box. The left box should be out of the way after the first call to move_and_collide
.
However, this same sequence of events works fine if spread over multiple frames. If I move the left box on frame 1, then the right box on frame 2, it works fine. This leads me to believe that when you move a KinematicBody2D it doesn't update its collision information in the physics engine until the end of the physics frame. If this is the case, then how can I get two KinematicBody2D objects that are close to each other to move in this way?