Page 1 of 1

updating camera position

Posted: Thu Feb 10, 2005 1:22 pm
by databandit
hi
can anyone give me some code on how to get the camera's position every frame . . . . i know the getAbsolutePosition function . . . but I need to know how to do it every frame...

thanks
zubair

Posted: Thu Feb 10, 2005 2:18 pm
by Guest
Every frame?

How about........putting it in the main loop? It loops through successive frames.

while(device->run()) {
BeginScene etc.
...
EndScene etc.
--> xyz = camera->GetAbsolutePosition etc.
}

Posted: Thu Feb 10, 2005 2:21 pm
by databandit
Anonymous wrote:Every frame?

How about........putting it in the main loop? It loops through successive frames.

while(device->run()) {
BeginScene etc.
...
EndScene etc.
--> xyz = camera->GetAbsolutePosition etc.
}
cant it be used in another function too?

Posted: Thu Feb 10, 2005 2:35 pm
by Guest
You can call it from anywhere where you can get access to the camera object.

If you have a global variable for the camera object you can access that variable in the OnPostRender function of any object (enemy node?) if you like.