Question

I'm making a little game in which I want to throw an object in direction I am facing. The problem is that my (camera) orientation is determined by model/view matrix. And this matrix is supplied by system (on android device).

How can I compute vector which will serve as velocity vector for my thrown object?
I tried multiplying some vectors with the matrix, but results doesn't give me a clue how to accomplish this.

Matrix contains only rotational part (no scale, skew or translate).
I am working with OpenGL ES 1.1, but it probably doesn't matter.

Following this answer I was able to get rotation angles around each axis, but I still don't know how to build my velocity vector from it.

EDIT: What I am trying to accomplish is to rotate model/view matrix in whatever ways, and throwing object the way I am facing. I need the object to eventually accelerate to the ground. I have no problem computing this trajectory, if I know exact vector I'm (camera is) facing.

Thanks for any help.

Was it helpful?

Solution

The first 3 columns of the modelview matrix are the bases of the view coordinate system. So all you need is the 3rd column (or row, depending if you're going from camera to world, or from world to camera).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top