Game Development Community

%client.player.getPosition()

by Grant McNeil · in Torque Game Engine · 06/11/2002 (4:17 pm) · 7 replies

%client.player.getPosition() wont work for me. can anyone tell me why?



thank you,

Grant McNeil

#1
06/11/2002 (5:31 pm)
Try instead this:
// Get player object transform
%transform = %client.player.getTransform();

// Get transform returns 7? digits seperated by a space
// The first 3 numbers of this variable represent
//   the position of the object
%posX = getWord(%transform, 0);
%posY = getWord(%transform, 1);
%posZ = getWord(%transform, 2);

// Optional step
%position = %posX @ SPC @ %posY @ SPC @ %posZ;
#2
06/12/2002 (2:35 am)
If I am right, you can get the position using %client.player.position.

greetings
Daniel
#3
06/14/2002 (2:45 pm)
%client.player.locate(); also works...I added this function to player.cs:
function Player::locate(%this)
{
   %this.getPosition();
}
#4
06/15/2002 (12:00 pm)
Isn't that just redundant? It does the same thing.

I think the problem here is people are not getting a correct %client or %player object, probably because they are working in a function that was never passed one or because it is passed one but its %this instead of %client or %player.
#5
06/16/2002 (8:26 am)
I'm sure you're right--I just couldn't get getPosition to work in a number of functions. Wasn't passing the right variables.... Some of your other recent posts have helped my understanding of the diffs between %this, %client, and %player. :)
#6
07/08/2005 (11:38 pm)
You know..... it doesnt work for me either.... However.. this does:

localclientconnection.player.getPosition()
#7
02/18/2006 (8:24 am)
Thanks, that was helpful with another problem. I was wondering why for the AI I was getting a player and the player I wasn't, but that's since I was getting a clientconnection instead.