Game Development Community

How do I find the player's current position?

by Mark Brown · in Game Design and Creative Issues · 04/15/2006 (10:59 am) · 3 replies

I understand where to spawn my player and can spawn him whereever I like. But once he starts to move, I know longer know where he is. How can I, within a *.cs script routine, get the player's current position? What type of variable do I capture this information in and how do I read it?

- Mark

#1
04/15/2006 (12:43 pm)
%pos = %player.getPosition();
#2
04/15/2006 (2:59 pm)
Well well the easiest way i found is to assign a variable to the player object when it's spawned. but if global variables wont cut it....

%pos = localclientconnection.player.getPosition();

is one way you might be able to get that info.
#3
04/15/2006 (3:51 pm)
Ramen,
Quote:Well well the easiest way i found is to assign a variable to the player object when it's spawned. but if global variables wont cut it....

Why would you do that? It's already available via shapeBase.

Quote:
%pos = localclientconnection.player.getPosition();

Which only will work if the player is the host.