Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Player Position and System Time
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#9
RE: Player Position and System Time

Download link:
http://www.mediafire.com/?5ijr4e73j4diidc

Basically, create an entity at any position - make sure it is static.
Go into the code, find the line that read:
const float[] _ORIGIN = { 0.0f,0.0f ,0.0f };
Put the coords of the entity into that array {X,Y,Z}.

Then call whenever you want to track the player's position the trackingBegin routine. An example of this is included w/ the test map.
//Create an Array with the position of the player {X,Y,Z}
float[] position = { 10.0f, 0.9f, 13.25f };
//Pass this into trackingBegin along with the origin object name.
trackingBegin(position,"object_origin");

Then, whenever you want to get the player location, do something like:
float[] p = trackingGetPosition();

Where:
p[0] = <x coord>
p[1] = <y coord>
p[2] = <z coord>
Note that all positions will be down to the accuracy of the const "_PADDING" - i have set this to "1" in the code as this is what i feel to be a reasonable value (good trade-off of accuracy and not creating a tonne of objects).

Please note, try to use this only when necessary (e.g at the start of where you want position tracking). Adding lots of collide callbacks & attach objects will eventually crash the game (about 10k ish), so don't go overboard with precision and amount of tracking. You can stop tracking by either hitting the object limit "_TRACKMAXNO" or calling:
trackingEnd();
(This post was last modified: 10-10-2011, 06:49 PM by Apjjm.)
10-10-2011, 06:46 PM
Find


Messages In This Thread
Player Position and System Time - by diabi85 - 09-28-2011, 01:09 PM
RE: Player Position and System Time - by palistov - 09-28-2011, 06:29 PM
RE: Player Position and System Time - by diabi85 - 09-30-2011, 09:23 AM
RE: Player Position and System Time - by Apjjm - 09-30-2011, 06:46 PM
RE: Player Position and System Time - by diabi85 - 10-01-2011, 10:52 AM
RE: Player Position and System Time - by diabi85 - 10-08-2011, 06:35 PM
RE: Player Position and System Time - by Apjjm - 10-09-2011, 12:37 AM
RE: Player Position and System Time - by Apjjm - 10-10-2011, 06:46 PM
RE: Player Position and System Time - by diabi85 - 10-10-2011, 07:03 PM
RE: Player Position and System Time - by Apjjm - 10-10-2011, 08:43 PM



Users browsing this thread: 1 Guest(s)