Archived

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

GliTch

height calculation

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

Share this post


Link to post
Share on other sites