About Store Forum Documentation Contact



Post Reply 
Player Position
Author Message
Rabishan Offline
Member

Post: #1
Player Position
Hi guys,

i'm trying to figure out the position of the player with respect to the ground. in esenthel i've seen player.pos function. if i'm not mistaken this does not give the actual ground position but position slightly above the ground position. what i need is the position and direction of the plane where the player is standing.

thanks in advance.
06-07-2011 07:42 AM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #2
RE: Player Position
1) Cast a ray that points downward from the player's position. Then, get the pos/normal via physHit.plane.pos and physHit.plane.normal.

2) Assuming you're always on a heightmap terrain, you can use this (position only):

Code:
Game::World.hmHeight(Players[0].pos().xz());

3) Or, to just get the position roughly near the player's feet, you can use this (position only):

Code:
Players[0].ctrl.actor.box().down();
06-07-2011 08:10 AM
Find all posts by this user Quote this message in a reply
Rabishan Offline
Member

Post: #3
RE: Player Position
thanks for the reply. seems like ray casting would be my options because i need plane direction more than plane position.
06-07-2011 08:13 AM
Find all posts by this user Quote this message in a reply
Post Reply