Im trying to get my camera to follow my player around as he moves.
Im doing this with cam->setPosition( players pos + camera offset )
and cam->setTarget(players pos)
but i get this glitch in som frames (quite many actually) that flicker the scene.
My guess is that it has something to do with the camera trying to rotate its
view towards the target (i dont get flickering if i remove the setTarget part)
has anyone got an ide of how to do better camera tracking or why it flickers
(and how to avoid it of course )
thanks //christoffer
Camera tracking
A search on the forum would help...
try to update the absolut position of the camor something like this (have a look at the docu)
try to update the absolut position of the cam
Code: Select all
cam->updateAbsolutePosition();
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
hmm, after a quite comprehensive search i still can't find a solution to my problem .
The problem is not with the camera not following its parent, and therefor the updateAbsolutePosition() does nothing to help me.
The problem goes away if i create another window for rendering (so that i have two active windows at the same time) but that starts a whole lot of other problems of course . It could be that its my graphic card thats a little out of style (old 1ghz toshiba laptop).
The problem is not with the camera not following its parent, and therefor the updateAbsolutePosition() does nothing to help me.
The problem goes away if i create another window for rendering (so that i have two active windows at the same time) but that starts a whole lot of other problems of course . It could be that its my graphic card thats a little out of style (old 1ghz toshiba laptop).
Thats how i do it, but thats when i get the choppy camera behavior. I use an array of 3 floats that hold the offset for the camera relative to the player (a note here is that i do not need to rotate the camera, the offset is fixed. If you need to rotate the camera around the player, use setRotation( <player movement vector>.getHorizontalAngle() ); to get the camera to look in the direction of your player).Maybe I have to take direction vector of model's movement and to subtract some defined 'distance' from it? if it's right, then how i can get this 'direction vector'?
I also use the addCameraFPS() with disabled inputkeys, wich gives me a camera without a target (since the offset is always the same, i dont need to update the target).
try my class
i created a working 3rd person camera, you can check out the source, its done in linux
freewebs.com/juliusctw
freewebs.com/juliusctw
irrlicht game character project
http://picasaweb.google.com/juliusctw/FinishedArt
http://picasaweb.google.com/juliusctw/FinishedArt