vector3d
vector3d
is there a way of getting to the individual coordinate variables of a vector3df? I'm trying to get the individual x,y,z values so I can print them to a file but cant get it to work. I looked through the file and it tried accessing them with .X, .Y, and .Z, which looked like the thing to do, but it's not.
-
- Posts: 50
- Joined: Tue Mar 09, 2004 9:53 pm
- Location: Spain
I do this:
m_fX = m_pSceneNode->getPosition().X;
m_fY = m_pSceneNode->getPosition().Y;
m_fZ = m_pSceneNode->getPosition().Z;
getPosition returns a ¿pointer? to the vector3df which indicates the position of the node.
m_fX = m_pSceneNode->getPosition().X;
m_fY = m_pSceneNode->getPosition().Y;
m_fZ = m_pSceneNode->getPosition().Z;
getPosition returns a ¿pointer? to the vector3df which indicates the position of the node.
There are only 10 types of people: those who understand binary and those who don't
--------------------------------------------
--------------------------------------------
that still wont work, maybe because I'm trying to use it on the camera. Here's my code.
Code: Select all
fprintf("coordinates","%f,%f,%f\n",camera->getPosition().X,
camera->getPosition().Y,camera->getPosition().Z);
-
- Posts: 50
- Joined: Tue Mar 09, 2004 9:53 pm
- Location: Spain
That code is very strange because fprintf function is used to write data into a file. Its first parameter is a pointer to a FILE struct.
Then you only have to do this:
Then you only have to do this:
I think that should workFILE *pFile = fopen("file.ext","w");
fprintf(pFile, "coordinates %f %f %f\n",camera->getPosition().X,camera->getPosition().Y,camera->getPosition().Z);
There are only 10 types of people: those who understand binary and those who don't
--------------------------------------------
--------------------------------------------