Position of FPS camera

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
Endar
Posts: 145
Joined: Mon Jun 14, 2004 7:59 am

Position of FPS camera

Post by Endar »

I'm looking to be able to grab the position of a FPS camera.

Anyone know how?
"The reputation of a thousand years may be determined by the conduct of one hour."
-Japanese Proverb
Endar
Posts: 145
Joined: Mon Jun 14, 2004 7:59 am

Post by Endar »

Okay, I found it. :D

Code: Select all

     // create a pointer to a camera
     scene::ICameraSceneNode* cameraPtr;
     cameraPtr = smgr->getActiveCamera();
     
     // var for camera vector
     core::vector3df camera_vector;
     
     // get camera vector
     camera_vector = cameraPtr->getAbsolutePosition();
Is there an easier way??
"The reputation of a thousand years may be determined by the conduct of one hour."
-Japanese Proverb
VPB
Posts: 36
Joined: Sat Apr 10, 2004 8:02 am

Post by VPB »

core::vector3df camera_vector = (smgr->getActiveCamera())-> getAbsolutePosition();

:lol:
condrula
Posts: 44
Joined: Wed Mar 10, 2004 11:51 pm
Location: italy

Post by condrula »

hello,
how can i print the position on the camera?

guienv->addStaticText(.... dont work!!
Endar
Posts: 145
Joined: Mon Jun 14, 2004 7:59 am

Post by Endar »

After you get the camera position, put this code in the while loop, after "driver->endScene()"

Code: Select all

wchar_t tmp[1024];
		swprintf(tmp, 1024, L"Camera Position: (%f, %f, %f)", camera_vector.X, camera_vector.Y, camera_vector.Z );
		device->setWindowCaption(tmp);
"The reputation of a thousand years may be determined by the conduct of one hour."
-Japanese Proverb
condrula
Posts: 44
Joined: Wed Mar 10, 2004 11:51 pm
Location: italy

Post by condrula »

thank you, it works now
Post Reply