Determining player coordinates on the client
by Marc Fielding · in Torque Game Engine · 09/25/2003 (12:43 pm) · 1 replies
Hi all,
After combing the forums, resources, and finally #garagames (Thanks, PaulDana!), I finally unearthed a straightforward way to obtain a client's positional data in both TorqueScript and C++. Of course, this isn't anything new for TGE vets, but I'm posting this for easy access by other rookies.
TorqueScript
------------
(ServerConnection.getControlObject()).getPosition();
C++
---
// Get game connection object
GameConnection* conn = GameConnection::getServerConnection();
if (!conn)
return;
// Get control object
ShapeBase* control = conn->getControlObject();
if (!control)
return;
// Get coords of player object
Point3F newCoord = control->getPosition();
A simple bit of code that's now simple to find! =D
-Marc
After combing the forums, resources, and finally #garagames (Thanks, PaulDana!), I finally unearthed a straightforward way to obtain a client's positional data in both TorqueScript and C++. Of course, this isn't anything new for TGE vets, but I'm posting this for easy access by other rookies.
TorqueScript
------------
(ServerConnection.getControlObject()).getPosition();
C++
---
// Get game connection object
GameConnection* conn = GameConnection::getServerConnection();
if (!conn)
return;
// Get control object
ShapeBase* control = conn->getControlObject();
if (!control)
return;
// Get coords of player object
Point3F newCoord = control->getPosition();
A simple bit of code that's now simple to find! =D
-Marc
About the author
Torque Owner Kevin La Barre
Kevin