Problem with physical dynamic object displacement due to physics lag by 1 frame

I have a kinematic object “circle” that I control via keys. To this object I have attached a dynamic object “rectangle” through a welded joint. I also have a wall. When the kinematic object collides with this wall, I calculate its position using the following formula:
go.set_position(go.get_position() + message.normal * message.distance)
But because the physics lags by 1 frame, I can see the dynamic object displacement from the kinematic object when I hold down the movement key.


Is there any way to solve this problem?

I attach an example of this problem:
physics-lag.zip (61.4 KB)

1 Like