Page 1 of 1

Camera lookat

Posted: Sat Feb 06, 2010 11:46 am
by Lupo
Hi,

For those Math gifted/talented people in the forum :) (you know who you are ;) )

Its a way to have a zgelibrary function to mimic/clone the GLU Camera LookAt ?

Something like Lookat( x, y, z) and then change the rotations of the camera to correctly look at that position/model ?

Thanks in advance,
Lupo

PS Bring the Quaternions!!!

Thinking a bit

Posted: Sat Feb 06, 2010 12:57 pm
by Lupo
Maybe its better to think in some kind of camera component/behaviour?
Like:
- Follow that model.
- First Person
- Overtheshoulder
- Panoramic

Posted: Sat Feb 06, 2010 1:52 pm
by Kjell
Hi Lupo,

You said it .. bring on the quaternions, you really need them for a gluLookAt type of function. However, when your game has a constant up axis, the math is actually very easy.

1st / 3rd person cameras I personally see as a scripting job instead of a generic component, as every game requires a ( slightly ) different implementation. A camera component on the other hand is one of the first things I requested about two years ago when first starting out with ZGE :wink:

*Although with the recently added OnBeginRenderPass it has become very easy to implement your own camera management system.

K

Camera

Posted: Mon Feb 08, 2010 4:21 pm
by Lupo
Thanks Kjell !

Any chance of the code snippet for constant up axis version?

:)

Posted: Mon Feb 08, 2010 5:44 pm
by Kjell
8)

Here you go ~

K

Posted: Tue Feb 09, 2010 5:53 am
by y offs et
Now that code has got to go in tips and tricks. :shock:

Posted: Wed Feb 10, 2010 12:38 pm
by diki
most definitely :)