public void ConvertToLocalSpace(TransformComponent parent) { Scale.Vector3 *= parent.WorldScale.Vector3; RotationEuler.Vector3 += parent.WorldRotationEuler.Vector3; Position.Vector3 = Vector3.TransformCoordinate(Position.Vector3, parent.World); }
public void ConvertToParentSpace(TransformComponent parent) { var invParentWorld = Matrix.Invert(parent.World); Scale.Vector3 /= parent.WorldScale.Vector3; RotationEuler.Vector3 -= parent.WorldRotationEuler.Vector3; Position.Vector3 = Vector3.TransformCoordinate(Position.Vector3, invParentWorld); }