Getting the position of the orbit camera
by Bryce · in Torque Game Engine · 01/09/2010 (8:01 pm) · 2 replies
I'm almost positive that I'll need to dig into the engine code for this one. Does anybody know how I could access the exact position of the camera when it is in orbit mode? If I use:
It will return the position of the observer (Alt+C) camera. Camera code is not my specialty, so help is very much appreciated!
Thanks,
Bryce
%camPos = ServerConnection.camera.getPosition();
It will return the position of the observer (Alt+C) camera. Camera code is not my specialty, so help is very much appreciated!
Thanks,
Bryce
#2
Usage in script:
01/10/2010 (12:17 am)
Yes, got it! Put this into GameConnection.cc:ConsoleMethod(GameConnection, getThirdPersonCameraPosition, const char *, 2, 2, "() Gets the position of the third person camera")
{
MatrixF cam;
Point3F camPos;
object->getControlCameraTransform(0,&cam);
cam.getColumn(3, &camPos);
char *returnBuffer = Con::getReturnBuffer( 256 );
dSprintf( returnBuffer, 256, "%g %g %g", camPos.x, camPos.y, camPos.z );
return returnBuffer;
}Usage in script:
%camPos = ServerConnection.getThirdPersonCameraPosition();
Torque Owner Daniel Buckmaster
T3D Steering Committee