# walk on hill

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

## 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 on other sites
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;

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

(You must login to your GameDev.net account.)

• 11
• 15
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
634151
• Total Posts
3015827
×