Top down camera

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
aungsithu
Posts: 39
Joined: Thu Sep 04, 2008 2:14 am
Location: Singapore
Contact:

Top down camera

Post by aungsithu »

Hi,
Another newbie question here. :)

I want to create a camera that looks down on the object from the top.

I tried to rotate the camera (camera->setRoatation(...)).
But I don't know why it didn't work.

Any ideas?

Many thanks
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

camera's ignore setRotation, you should use setTarget(point to look at) so something like this:

camera->setPosition(0,100,0);
camera->setTarget(0,0,0);

That looks down directly from 0,100,0. Remember when you move your camera you'll have to update its target too so it keeps looking directly downwards, but that's easy as you could just do this:

camera->setPosition(newPosition);
newPosition.Y = 0;
camera->setTarget(newPosition);
Image Image Image
aungsithu
Posts: 39
Joined: Thu Sep 04, 2008 2:14 am
Location: Singapore
Contact:

Post by aungsithu »

got it. Many thanks.
c0de_m0nkey
Posts: 1
Joined: Wed Apr 22, 2015 1:04 am

Re: Top down camera

Post by c0de_m0nkey »

If you still need to rotate the camera after setting postion and target;

Code: Select all

 
        Camera->setPosition(0,100,0);
        Camera->setTarget(0,0,0);
you will need to change the Up Vector for the camera.

Code: Select all

        core::vector3df cPos = Camera->getUpVector();
        cPos.rotateXZBy(0.1, Camera->getPosition());
        cPos.Y = Camera->getPosition().Y;
        Camera->setUpVector(cPos);
Post Reply