I am trying to make an addon for a 3D game, that will require to fly in certain areas, that will be defined in a very long JSON array. The game works with coordinates, and the cube will be determined via coordinates too.
How can I check if the point given in the function with its lat, lon, and alt is in a defined box? The code must also be very light, as it would run every 50ms or so.
How the code would look like:
function checkIfInBox(playerLat, playerLon, playerAlt, cube){
//code to determined
if (inCube === true){
return true
}
else {
return false}
}
playerLat, playerLon and playerAlt would be integers, while cube would be an array with all 8 corners of the cube.