Reputation: 5616
Say I am using the below code to setup a projection view :
float aspect = fabsf(self.view.bounds.size.width / self.view.bounds.size.height);
GLKMatrix4 projectionMatrix = GLKMatrix4MakePerspective(GLKMathDegreesToRadians(65.0f), aspect, 4.0f, 10.0f);
self.effect.transform.projectionMatrix = projectionMatrix;
If I now wanted to make to camera look at a specific point in my scene, how would I best achieve this ? Currently I am changing the modelViewMatrix to move the object so it is centred in view, but am wondering if I could achieve the same by manipulating the projectionMatrix somehow.
Upvotes: 3
Views: 885
Reputation: 126117
As any good 3D programming basics tutorial (like maybe this one) will tell you...
The Projection matrix already works in terms relative to the viewpoint -- you've already fixed where the eye is and what point it's looking at, so the projection matrix only changes your field of view angle, aspect ratio, and near and far clipping planes. If you want to change the point you're looking at, specify a different LookAt
transform for your View matrix.
Upvotes: 2