How to get the height of the camera from the ground
The simplest way:
let heightFromCameraToGround = camera.position.y - ground.position.y
2 Likes
or otherwise in the case of a terrain generated with a heightmap :
const y = ground.getHeightAtCoordinates(camera.position.x, camera.position.z);
const heightFromCameraToGround = camera.position.y - y;
if the terrain is hilly, this will retrieve the distance Y between the camera and the terrain relative to the position of the camera
4 Likes