How do I store camera positions

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
WhytWulf
Posts: 51
Joined: Mon Sep 08, 2003 11:14 am
Location: Australia, Tamworth, NSW
Contact:

How do I store camera positions

Post by WhytWulf »

What I am trying to do is based on the Irrlicht TechDemo where you have multiple camera setup.
I am using the FPS camera for main navigation once you press RETURN, it switches to Maya mode, so I can use the mouse cursor. The problem is saving the camera position between changes.

Currently I have a

Code: Select all

vector3df CameraPosition; //current camera position vector
......
....
then to retrieve camera position

Code: Select all

camera->setPosition(CameraPosition); //use stored position
the problem occurs when I try to store the position, and I get compilier errors....

Code: Select all

CameraPosition=camera->getPosition();
Oh by the way Niko, I would never have thought about creating different cameras to handle this problem, and it gave me the idea...You the Man :)
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Hm, what compiler errors?
WhytWulf
Posts: 51
Joined: Mon Sep 08, 2003 11:14 am
Location: Australia, Tamworth, NSW
Contact:

Post by WhytWulf »

whoops, I have been playing around wiht it I don't get compiler erros anymore.. think is was realted to pointers (I hate them, and I hate interclass communication even more :)

okies.. when I call my function

Code: Select all

CurrentCameraLocation=camera->getPosition();
from anywhere other than in the OnEvent() , I get exception errors (pointers again ..yuck) (whihc is my mistake and not the engines). I'm trying to find the best place to put the.

Code: Select all

CurrentCameraLocation=camera->getPosition();
ATM. it is inside my OnEvent(), when I press RETURN to switch cameras. but for some reason it doesn't restore the position. when I switch back to FPS camera

Code: Select all

...
{
model1->setVisible(true);
model2->setVisible(true);
campFire->setVisible(true);
timeForThisScene = -1;
camera = sm->addCameraSceneNodeFPS(0, 100.0f, 300.0f);
camera->setPosition(CurrentCameraPosition); //restore saved position
scene::ISceneNodeAnimatorCollisionResponse* collider = sm->createCollisionResponseAnimator(metaSelector, camera, core::vector3df(30,50,30), core::vector3df(0, zoneLevelMesh ? -100.0f : 0.0f,0), 100.0f,core::vector3df(0,40,0), 0.0005f);
camera->addAnimator(collider);
collider->drop();
break;
}
...
come to think of it, I have no idea where it is getting the X,Y,Z from..
Post Reply