• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Maths | Quadrilateral - Height at point given 4 corners

Pandavim

Member
Hey everyone! (sorry for asking so many questions on this forum)
I've been working on an isometric engine with height in it. What I've done so far VUntitled.png
I tried summing up the question in the title, but in much more detail: I have a quadrilateral, each point is at a certain height, if I'm given the point on the quadrilateral (from above), how would someone calculate the height of that point. Thanks!
 

jo-thijs

Member
Why would you be sorry for asking many questions on the forum?

Anyway, if I understand you correctly, you've got a bunch of points at certain heights.
You then divide the entire field into quadrilaterals with the given points as vertices.
You now pick a random point on the field and you want to know what height it has.

With this information, it is impossible to determin the height of a random point.
You will need to define a correlation between the height of a random point
and the heights of the vertices of the quadrilaterals on which the random point lies.

You could say you want a linear interpolation between the points,
but then you'll get inconsistent results when the 4 vertices are not coplanar.
And even if they are coplanar, they can still give inconsistent results.

So, you probably won't be able to use linear interpolation,
but then what do you want to use?
 
I

icuurd12b42

Guest
if the 4 points are on the plane (coplanar), you can use a point to plane distance function
if the 4 points are not on the same plane like it's 2 different triangles, but form the shadow it does not look like they are, they you need to figure out which triangle you are on to figure out the plane data to use...

Making the points co-planar is a little tedious beccause you have to smooth the points until they are "flat" enough on the plane but it makes for faster grid lookup
the resust is a fast lookup, in this case one check in the middle of the tank is good enough. minor errors here and there

In my case I got a grid, top down all the grid cells are the same size. each cell holds an array of 4 points for the 4 corners the cell covers, each point is an array of 3 elements, x,y,z. when I create the terrain I average the cells corner points with the connected neighbour cells points iteratively like 8 times until all the points are relatively co planar
 
Top