Trying to tackle this feature shows how much effort is put in video games try to blend people walking up and down some sort of incline to make it seem real.
At first I tried to solve this by grabbing the closes vertex then taking the average of the neighbors which isn’t very accurate but it demonstrates the purpose of this assignment.
Then I attempted to change it to a spin off of linear Interpolation at a specific point. I measured the hypotenuse from the 4 corners and took a percentage of that to the height. But I was having problems when putting all the numbers together because they contained weighted averages.
My latest attempt was to throw out hypotenuse and just measure the containing area of each corner to the height which gave me a closer approximation. For instance if my (x,y) was (33.56, 20.45), then xDouble = .56 and yDouble = .45. Then depending which corner, decimal or 1-decimal, I would use these values and multiply them with a corner and then add the 4 corner contribution float values together for my new camera height.
Here are some examples along with some detail pictures.
2nd picture: middle row represents contributions from corners, topleft, topright, botleft, botright respectively. Last row represents cameras previous y position then moved to terrainY value.
Here is another picture.
Notice how every change in either x or z changes camera’s height which at some times is nice and fluid and other times it is very jagged. So I’m curious how you can make it near-perfect camera transitions.
Resources to accomplish this Feature: Chris and a couple peers, I also used the c++ book, that he gave out in 330, to double check if I was crazy or not, finding an error if outputs were the result of me accessing wrong locations or if it was an arithmetic error in my algorithm.