Skip to main content
gamedev.net
🔒 Locked

height calculation

Started by GliTch Jan 16, 2002 at 1:38 PM 0 replies 550+ views
Original Post
GliTch
GliTch
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?
VBlimits
VBlimits
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
-VBLimitsSorry about the Spelling..

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.