#### Archived

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

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

## Recommended Posts

Ok, the problem is that I''m trying to find any point on the quad and can''t get it working. I got a simple terrain, consisting of quads, and each quad vertice is binded to heightfield value, e.g 5 or else. Height is y axis. So, if I got each square of same initial size e.g. 16 units x 16 units, how do I find any point within initial square projected up on modified quadriliteral? i.e : Got initial square 0,16 16,16 . 7,9 0,0 16,0 I need to project point 7,9 up on polygon to get its height. How do I do that? Please help. Thanks.

##### Share on other sites
What are you using this for?

The reason Im asking is that this type of calculation can have a very high error percentage if used incorretly. A former programmer here had the brillant, yeah right, idea to project a 2d car simulation onto the 3d surface of the road in the racing game he was lead on. Yeah it worked great for flat roads but as soon as you got onto anything that a bank in it, the car would bounce and pop around like it was on crack.

On a side note:
This poorly written game went to market and was reasonably successful.

Regardless of potential problems, the math is simple ratios.

The hieght of 7,9 in the 0 to 16 square grid would be..

length_ratio = (7-0)/(16-0) // how far along in this grid are we.
width_ratio = (9-0)/(16-0) // how far along in this grid are we.

// now to figure out the inbetween line for length.

heightAt7_0 = ( heightAt16_0 - heightAt0_0 ) * length_ratio;
heightAt7_16 = ( heightAt16_16 - heightAt0_16 ) * length_ratio;

// now for the width and our final height

heightAt7_9 = ( heightAt7_16 - heightAt7_0 ) * width_ratio;

1. 1
2. 2
frob
20
3. 3
4. 4
Rutin
17
5. 5

• 21
• 13
• 10
• 9
• 18
• ### Forum Statistics

• Total Topics
632555
• Total Posts
3007050

×