Jump to content
  • Advertisement
Sign in to follow this  
Ecoste

3D Navigation Math Problem!

This topic is 2530 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

Hi, i'm currently using a 3d Engine, and i'm trying to make the character move where it's facing(Where the camera is facing basically) And, it's working out. But, the problem that i'm having is when I move the camera, the character changes speed. So, to solve this problem we need to dumb down the numbers, and when you would add them it will ALWAYS equal x. In our case, the x = 2.


5x 5z ->>> 1x+1z = 2
10x 10z ->>> 1x+1z = 2
15x 15z ->>> 1x+1z = 2
15x 30z ->>> x + z = 2

I think I need to take the ratio and somehow put it... I don't know myself, so that's why i'm asking you guys. Help is very much appriciated :3

EDIT: I figured it out, you need to find out the ratio of x and z summed up - compared to x. So if it's 15x to 30z the ratio will be 1:3(15 x 3 = 45). Then, you need to apply that ratio to 2(2 / 3 * 1), that will give you the x, and then you just 2 - x to get the z.and z takes the x value.

EDIT: Worked in my head, doesn't work when you put it in the code! :3 Because, x can become negative.

Share this post


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

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!