# 3d Movement with Origin and Vector (Angles)

This topic is 2807 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm not a super math type, but I'm still interested in learning. I've been working on this game that I've been developing in blender, but I need some help on my php server end.

Basically, the server needs to calculate the next given location of a player.

My input is:
x,y,z and roll/pitch/yaw along with the distance travelled.

This is what I have so far, but I realised it's totally wrong. Was wondering if someone could help me out?
    $this->current_x =$this->current_x + $distance * cos(deg2rad($a)) * sin(deg2rad($z));$this->current_y = $this->current_y +$distance * sin(deg2rad($a)) * sin(deg2rad($z));    $this->current_z =$this->current_z + $distance * cos(deg2rad($z));

##### Share on other sites
Ok, so i found an example on some obscure forum. My final code ended up being:

    $a =$this->current_yaw;    $z = -$this->current_pitch;        // orig    $this->current_x +=$distance * cos(deg2rad($a)) * cos(deg2rad($z));    $this->current_y +=$distance * sin(deg2rad($a)) * cos(deg2rad($z));    $this->current_z +=$distance * sin(deg2rad(\$z));

Thought i'd share that with you all!

1. 1
2. 2
Rutin
22
3. 3
4. 4
JoeJ
15
5. 5

• 14
• 30
• 13
• 11
• 11
• ### Forum Statistics

• Total Topics
631776
• Total Posts
3002300
×