I'm drawing a hierarchy of 3D objects in C# XNA where each objects has a transform that holds position, rotation and scale.
I get my expected results If I draw my objects from my root node in this fashion:
public void Draw(Matrix world, Matrix view, Matrix proj)
{
foreach (var item in Children)
item.Draw(world * item.Transform, view, proj);
}
However, I want to draw my objects by starting with a child node, drawing upwards, and achieving drawing from a child-object relative space. How would I do this?
I've tried a number of ways or drawing the parent nodes with inverted transform, but I'm not getting the correct results, I'm guessing I need to take care of the multiplication order, but I don't know what that is if I'm going up instead of down.