how to I get to see the coordinates of the camera? [solved]

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
~ Dream
Posts: 12
Joined: Fri Jun 29, 2007 11:28 am
Location: The Dream World

how to I get to see the coordinates of the camera? [solved]

Post by ~ Dream »

I added
std::string coord = camera->getPosition();
std::cout << coord << std::endl;
so that I can see the coordinates where the camera is that thus I can use the numbers I get and set it as the starting point whenever the game loads.
But there is an error because getPostion cannot be converted into a String. Any ideas how to solve that or is there a better way to determine what coordinates I need to set in camera->setPosition(core::vector3df(-100,50,-150));

thanks.
Last edited by ~ Dream on Wed Jul 04, 2007 5:45 am, edited 1 time in total.
~ Dream
Atraides
Posts: 18
Joined: Wed Jun 06, 2007 1:09 am
Location: Australia

Post by Atraides »

you need to convert the variables into a stringw to be able to display them.

for example if i wanted to display the coordinates in the static text box

vector3df pos = camera->getPosition();
stringw testString = stringw("Position X:") + stringw(pos.X)+stringw("Position Y:") + stringw(pos.Y)+stringw("Position Z:") + stringw(pos.Z);

then set that to be the static text scene nodes value.


Hope that helps

Cheers
Courtney
~ Dream
Posts: 12
Joined: Fri Jun 29, 2007 11:28 am
Location: The Dream World

Post by ~ Dream »

thanks, it worked well as planned :)
~ Dream
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

In case you do such string stuff in timing critical places you should avoid making string objects from the elements. Simply assign or append the elements in several statements. This also saves you from creating the additional string object of the concatenation on the RHS.
Post Reply