0
votes

I have a series of transformations that take my object and put it somewhere else. I am manually multiplying these transformations for the programmable pipeline in GL/ES. I'm rotating around distant arbitrary points and also translating, and while I have no trouble getting my object to finally position where I want it, I'd like to know how I can extract the final 3D vector coordinate of its position after these transformations.?

One option, suggested by this question, is to simply multiply your starting position by the final matrix and keep that result vector as the final coordinate. If so, what is the vector I use to represent my object's origin before these transformations? Because multiplying a matrix by my origin (0,0,0) simply results in a vector of zeroes.

1

1 Answers

0
votes

The solution is surprisingly simple.

If I have a matrix M that is the final transformation created by all the matrix multiplications, then I can find the center of an object transformed by M by simply:

M * vector(0,0,0,1) // creates a 4D vector, where the first three, x,y,z are the coordinates

This is easily done manually in the code.

The key piece the question was missing was the exact vector to use for this multiplication.