Getting the camera working wasn’t too hard, as I just followed the video we were given in class. Getting it to adjust to the terrain’s elevation proved to be the tricky part. I looked at other people’s post mortems and online material about bilinear interpolation to figure out what to do.
Fist I implemented two new methods in ObjUtilities that created an elevation map of the terrain’s Y values and a method that actually found the needed Y value based on the inputed X and Z values. Then I added a method to camera class that sets the actual camera’s elevation based on the retrieved value.
A snippet of my new methods in ObjUtilities
A snippet of new methods in my camera class
And a video of the camera adjusting to terrain elevation in action.