Farseer/Box2D with SceneGraph

Hello everyone! The game has a SceneGraph system. Any GameObject object has local and world coordinates. The world coordinates are added up every time: 1. The object’s local coordinates have changed. 2. The parent of the object changes the local and world coordinates.

For physics to work correctly, objects must move in world coordinates. I initialize the Rigidbody (Box2D wrapper of the Body class) component and assign the Body.Position world coordinates. In the Update method, the GameObject object must be assigned new local coordinates after the physics calculation. But there is a problem: What should I do if a parent has changed their position?

Maybe someone had a similar problem?

Funny. I found the solution myself. For correct operation, it is necessary to assign GameObject world coordinates. But first we need to calculate the difference between the world’s past and new coordinates, and add this difference to the local ones.