Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


height calculation

This topic is 6030 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 created a terrain and I''m trying to make my character to walk on it. my idea is to 1. Determine which tile my chracter is on 2. Determine which of the two triangle its on. 3. Calculate the height. Now my problem is on 3. How do i calculate the height? is my idea the right way of doing it or is there easier way of doing it?

Share this post

Link to post
Share on other sites
Umm did you load it from a hight map?? ( a gray scal bit map )?
if so i would find the X,Y on the bitmap and do the same math to it and get the hight that way
or you can find the two points along the same axie
| \
| \
1 2
line 1-0 and find where your character is on that line then find the hight at that point like this

H = (Point(1).y-Point(0).y)*CharacterX
where CharacterX is where the character is on the line relitive to point 0 (e.g. CharacterX = Point(0) - Character where Point(0) is a vector and Character is a vector defining there postions in world space)

simple enuf
that should work i just did it of the top of my head but taht will give you an idea of how to do it


Share this post

Link to post
Share on other sites

  • 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!