Jump to content
  • Advertisement
Sign in to follow this  
derek7

walk on hill

This topic is 4749 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 now take these step. first move a distance alone the xz plane,then get a new position(x z)then according to height map get y value of new position(x z). but these work unreal.because the move more much distance because of a height. so how to handle the problem?

Share this post


Link to post
Share on other sites
Advertisement
You can check the length from the current position to the next one.
If you have a vector class (and you should):

Vector currentPos = Your current position;
Vector nextPos = "next" position;

float distance = (nextPos - currentPos).Magnitude();



So to limit the speed to 1 unit you could do like this:

Vector dir = nextPos - currentPos;
dir.Normalize();

currentPosition += dir;


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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!