Game Development Community

Determining position

by Edward Gardner · in Torque Game Engine · 09/08/2001 (5:13 pm) · 4 replies

Is there a function that determines position on the map, something that can echo X,Y coords back to the consoe or to a control?

Same question for relative "speed" of the chracter or vehicle.

Finally, how about a FPS command?

#1
09/08/2001 (9:48 pm)
Hi,

For FPS, see the Metrics commands.
metrics("fps");
I think [??] I would have to re-check.

David
#2
09/09/2001 (2:00 am)
You just need to get the object transform for the player.

%pos_x    = getWords(%obj.getTransform(), 0, 0);
%pos_y    = getWords(%obj.getTransform(), 1, 1);
%pos_z    = getWords(%obj.getTransform(), 2, 2);
messageClient(%obj.client,"","X = " @ %pos_x @ " Y = " @ %pos_y @ " Z = " @ %pos_z);
#3
09/09/2001 (2:19 am)
To get the speed of the player you can do:

%speed = getWords(getControlObjectSpeed(), 0, 0);
messageClient(%obj.client,"","speed = " @ %speed);
#4
09/10/2001 (6:18 am)
Ok, here's the final outcome:

in server commands.cs add this:

function serverCmdpositionEcho(%client)
{
// position echo
%pos_x = getWords(%client.player.getTransform(), 0, 0);
%pos_y = getWords(%client.player.getTransform(), 1, 1);
%pos_z = getWords(%client.player.getTransform(), 2, 2);
messageClient(%client.player.client,"","X = " @ %pos_x @ " Y = " @ %pos_y @ " Z = " @ %pos_z);

//speed echo
%speed = getWords(getControlObjectSpeed(), 0, 0);
messageClient(%client.player.client,"","speed = " @ %speed);

}


Then bind a key to it :)

Thanks to Nelson and Josh A for holding my hand thru this :)