Camera move back

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
grantkrieger
Posts: 25
Joined: Fri Jul 27, 2007 10:02 am

Camera move back

Post by grantkrieger »

Hello,

Is there any easy way of just moving the camera back. EG reversing the camera backwards at the same angle it is currently positioned.

Many thanks

Grant
NoodlePowa
Posts: 32
Joined: Sun Jul 15, 2007 1:02 pm
Location: California

Post by NoodlePowa »

I don't quite understand your question (because my brain is a couch potato right now), but if you mean to reverse where the camera looks:

Code: Select all

camera->setRotation(vector3df(0.0f, 180.0f, 0.0f));
I think that'll work... :oops:



But if you don't mean that, and you mean to move the camera back:

Code: Select all

camera->setPosition(camera->getPosition() + vector3df(0.0f, 0.0f, -1.0f));

Again, I don't quite understand your question... and I'm still a beginner :P .
"Be not ashamed of mistakes and thus make them crimes."
-Confucius
grantkrieger
Posts: 25
Joined: Fri Jul 27, 2007 10:02 am

Post by grantkrieger »

Thanks a million. You answered my question correctly. The second option was what I was looking for. Sorry about my confusing statement

Thanks again
kendric
Posts: 71
Joined: Tue May 29, 2007 9:05 pm

Post by kendric »

Also for the first method, you would set the target, not the rotation of the camera to make it look behind you.
So something like
vector3df delta=camera->getTarget()-camera->getPosition();
delta.inverse() (forget the function name but negate or inverse)
camera->setTarget(delta);
Post Reply