Page 1 of 1

Camera move back

Posted: Tue Aug 07, 2007 9:59 am
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

Posted: Tue Aug 07, 2007 10:17 am
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 .

Posted: Tue Aug 07, 2007 2:19 pm
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

Posted: Tue Aug 07, 2007 4:41 pm
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);