I've been writing a Parent/Child Entity system for a small game and I am having a problems when I try to get a child object's location.
As it stands now, the child of an Entity are transformed, rotated, and scaled in the coordinate space of the parent. This means that if our parent is at a location of ( 2, 3, 0 ) and we add a child to that parent at a location of ( 1, 2, 1 ), its world space is ( 3, 5, 1 ).
My problem is that I don't know how to convert from the local space ( 1, 2, 1 ), to the global space ( 3, 5, 1 ).
The obvious place to start is by adding the parent position and the child position. This works for non-rotated objects. Whenever rotation and scale are applied though it gets confusing and this is what I cannot figure out.
I read somewhere to use inverse of matrices but the explanation beyond that was not clear. Any help/mathematical insight/pseudocode would be greatly appreciated, thanks!