# 3d position calculations

3 replies to this topic

### #1 kaibil

kaibil

GMC Member

• GMC Member
• 119 posts
• Version:GM8

Posted 05 June 2012 - 05:44 PM

Greetings, could anyone explain to me on how to find 3d positions relative to an Object... for example, the player, and finding the x,y coordinates of his back. So my game is 3rd person, and I would want to calculate the x,y behind him, relative to his position and direction... Ive seen someone do it using the Lengthdir functions, but Im not sure how.. someone please help me.

Edited by kaibil, 05 June 2012 - 05:44 PM.

• 0

### #2 PoniesForPeace

PoniesForPeace

puzzling

• GMC Member
• 493 posts
• Version:GM:Studio

Posted 05 June 2012 - 06:01 PM

x2=x+lengthdir_x(10,direction)
y2=y+lengthdir_y(10,direction)

compared to original coords, new coords will have moved 10 pixels in direction direction.

Edited by PoniesForPeace, 05 June 2012 - 06:01 PM.

• 1

### #3 kaibil

kaibil

GMC Member

• GMC Member
• 119 posts
• Version:GM8

Posted 05 June 2012 - 06:08 PM

x2=x+lengthdir_x(10,direction)
y2=y+lengthdir_y(10,direction)

compared to original coords, new coords will have moved 10 pixels in direction direction.

Thank you! Works like a charm. If I ever release this game ill make sure to give credit.

Edited by kaibil, 05 June 2012 - 06:08 PM.

• 0

### #4 PoniesForPeace

PoniesForPeace

puzzling

• GMC Member
• 493 posts
• Version:GM:Studio

Posted 05 June 2012 - 07:59 PM

x2=x+lengthdir_x(10,direction)
y2=y+lengthdir_y(10,direction)

compared to original coords, new coords will have moved 10 pixels in direction direction.

Thank you! Works like a charm. If I ever release this game ill make sure to give credit.

not neccesary, but sure
• 0

#### 0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users