I have been working on a component based engine with nested game objects each with there own transformation's. Each game object calculates its position in the world based on its parents world transformation multipled by there own local one (ModelsWorldTransform = ParentsWorldTransform * LocalTransform).
This all works great until I attach the camera component to a model and in this scenario, as the model the camera is attached to moves away from the origin, the camera moves in the opposite direction to the movement whitest still seeming like it is in the correct position according to its mat4.
All local transformations are stored in a mat4 rather then three vec3's for position, rotation and scale to save on calculations each update having to generate new mat4's.
Transformation Component Update Code
m_world_transformation = m_local_transformation; // If we have a parent object if (m_parent_transform_component) m_world_transformation = m_parent_transform_component->GetWorldTransformation() * m_world_transformation;
Camers position buffer being updated
BufferData.view = m_transformation_component->GetWorldTransformation(); m_camera_buffer->SetData();
I'm not sure what i'm missing, if anyone has any sugestions that would be apreatiated.