camera's co-ordinates

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
LordBob

camera's co-ordinates

Post by LordBob »

Hi everybody,
I try to modify the source of the tutorial n°3, i want to draw on the window the coordinates of the camera, but i don't know, how can i do that... Somebody can help me please?
Bob (a French user of Irrlicht :wink:)
schick
Posts: 230
Joined: Tue Oct 07, 2003 3:55 pm
Location: Germany
Contact:

Post by schick »

Please, do not ask such basic howto questions in the "advanced help" forum, use the beginner forum instead.

First get a pointer to the current used camera and receive its position.

Code: Select all

vector3df cam_pos = YourSceneManager->getActiveCamera()->getPosition();
Then format the the cam_pos into a string using the c or c++ way.

c: sprintf()

c++: stringstream

Code: Select all

using namespace std;
stringstream sstr << cam_pos.X << "-" <<  cam_pos.Y << "-" << cam_pos.Z;
string str << sstr;
Then print it to the screen as shown in tutorial 1.

Code: Select all

YouGuiHandle->addStaticText( str.c_str(), rect<int>(10,10,200,30), true);
Please send me an e-mail instead of a private message.
LordBob

Post by LordBob »

thanks a lot for the answer and i'm sorry for ask my question here... but i ask the same question in the beginner forum before, but nobody answer...
i'm sorry and thank you schick !!!
bye
Bob (a French Irrlicht user)
Post Reply