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
Top down camera
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);
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);
-
- Posts: 1
- Joined: Wed Apr 22, 2015 1:04 am
Re: Top down camera
If you still need to rotate the camera after setting postion and target;
you will need to change the Up Vector for the camera.
Code: Select all
Camera->setPosition(0,100,0);
Camera->setTarget(0,0,0);
Code: Select all
core::vector3df cPos = Camera->getUpVector();
cPos.rotateXZBy(0.1, Camera->getPosition());
cPos.Y = Camera->getPosition().Y;
Camera->setUpVector(cPos);