Problem with camera target

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
DeusXL

Problem with camera target

Post by DeusXL »

I have create a camera scene node and when I want to do a rotation, the camera doesn't do anithing :evil: I think it's because the target of the camera stay always the same and the rotation have no effect !
Mercior
Posts: 100
Joined: Tue Feb 24, 2004 1:53 am
Location: UK
Contact:

Post by Mercior »

camera roation is just for the node - other nodes that are attached to the camera will rotate based on the cameras rotation.

Use setTarget() to change where the camera looks at
DeusXL

Post by DeusXL »

Ok but if I want a progressive rotation of the camera, must I set an Mesh invisible as target and put an animation on this mesh or there is another thing.
When I set a target it doesn't look pretty good :-(
DeusXL
Posts: 114
Joined: Sun Mar 14, 2004 9:37 am
Contact:

Post by DeusXL »

And when you setVisible(false) a Mesh, animation don't work but I find something who work ( well ? ) :

Code: Select all

cameratarget->setScale(vector3df(0.0f,0.0f,0.0f)); 
Please help me because I think there is another way :roll:
Irrlicht .NET complete and Cross Platform Wrapper
The kid on my avatar wrote:A painless lesson is one without any meaning
Mercior
Posts: 100
Joined: Tue Feb 24, 2004 1:53 am
Location: UK
Contact:

Post by Mercior »

If you want progressive rotation then you'd need to keep an angle variable:

Code: Select all

int angle;
then keep updating the camera like so:

Code: Select all

angle ++;
float xTarget, yTarget;

xTarget = sin(PI*(angle/180)) * 10;
yTarget = cos(PI*(angle/180)) * 10;

core::vector3df campos = camera.getPosition();
core::vector3df newTarget = campos + vector3df(xTarget, campos.Y, yTarget);

camera.setTarget(newTarget);
That should make the cameras target rotate in a circle around the camera. Hope it helps
Post Reply