Hey everybody,

I have a question about how to combine a scenegraph with a physics engine.

A scene-graph usually consist of a hierarchy of entities. Child-entities inherit their transformation from their parents. So typically each entity has a world-transform and a local-transform which is relative to it's parent.

The physics engine will do the physics computations for a number of scene entities (if not all). It's output consist of matrices for all simulated entities (and additional parameters such as speed, torque etc)..

Making the two cooperate gives me the following problem:

The physics simulation runs in world-space and thus gives me world-matrices for my entities. However, I would prefer local matrices instead, because I normally compute my world matrix from my local matrix and not the other way around.
Making both the world- and the local transform "settable", will be cumbersome because I don't know which information is up-to-date.
After setting one of them, I could update the other one, but that will become very expensive.

This made me realize that the physics engine does not know about the parent-child relations between entities in my scene graph. I honestly don't know how to combine the two without alot of overhead or messy code.

I would like to keep the two separated. However, I still have to deal with the transformations and the local/world space problem.

Can anybody show me some good ways to tackle this issue?

Thanks!

P.S: Also asked this on gamedev.net: here