Me and my friends are creating a simple 3D game in LibGDX and are currently trying to implement simple collision detection with the terrain (ground). For this I thought the best way would be to simply get the
y-value (height) of the piece of terrain the player is currently standing on, and limit the player's
y-position to that value.
For this I need some way to get the 3 vertices that make up the triangle the player is standing on and then use some type of interpolation (probably barycentric) to get the correct height. The problem is that LibGDX's
ModelData classes only contains a raw vertex array(s) of floats with no built in way to acquire the information we need. So my question is fairly straight forward:
Is there a way to acquire the three vertices that we need to perform this interpolation or Is there another way to acquire the height of the terrain given the coordinates
PS. I know using a heightmap instead of a model could solve this problem, but we'd much rather use LibGDX's built-in systems unless absolutely necessary.