Jump to content
  • Advertisement
Sign in to follow this  
josefnpat

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!