I need to perform a static collision detection between two objects using C++/OpenGL. I have written the code for the collision detection but this code uses the vertices of the two models as given in their .obj files and not the coords of their current positions (which is what I want).
I have performed to both models a Translate and a Scale transformation and I need to know what are these coordinates right now. I guess it has something to do with transformation matrices etc but how is this combined to the initial coordinates?
Can anyone help me?
If you just have translation t and scaling s, you can simply calculate the actual positions with:
world_position = s * model_position + t
If you have an arbitrary transformation given as a matrix M, you calculate the position with:
world_position = M * model_position
//where model_position should be a 4d vector with w-coordinate 1