#### Archived

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.

## 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 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
like
0
|\
| \
| \
|___\
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

-Ian

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
18
5. 5

• 14
• 22
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631766
• Total Posts
3002221
×