Advertisement

Following camera.

Started by September 26, 2002 03:16 PM
0 comments, last by josemarin 22 years, 5 months ago
Hi! Someone knows where could I find some tutorial abou camera following an object? For example, in my game, sometimes the camera is behind the ship, sometimes is over the ship. How to deal when the camera is behind(and above) the ship?
I would think that gluLookAt would be the quickest way to do this and it has been mentioned elsewhere in reply to a similar question.

objx,objy,objz - holds position of object to follow
camx,camy,camz - holds position of camera following object
upx,upy,upz - holds direction of up axis

use gluLookAt(camx,camy,camz,objx,objy,objz,upx,upy,upz)

when cam position is slightly behind and a above objects position which it is viewing using the obj values or some similar amount.. maybe objz-5 to see a part of the object or objz-10 to see all of the object or objz to be literally in the pilot seat so to speak.

There may well be better ways of doing this but this is where I would first try it out...

Tina

This topic is closed to new replies.

Advertisement