Is there a way to restrict the camera from moving below a scene? I want to be able to rotate around it just not below it.
Not sure if I get you, but are you finding ArcRotateCamera | Babylon.js Documentation?
What does your scene contain? I’m using the following code to keep the gamera above a ground object:
const ray = new Ray(this.camera.position, Vector3.Down(), 1).intersectsMesh(this.ground)
if (ray.hit) {
this.camera.setPosition(new Vector3(this.camera.position.x, ray.pickedPoint!.y + 1, this.camera.position.z))
}
The answer is ‘Yes’ and the solution(s), that are nearly always multiple in BJS, depend on the type of camera. What camera are you using?
Yeah, I posted this when I got a little frustrated with the docs. I understand this camera decently now
love this, I have been learning more about ray tracing recently. This is very helpful
turning on collision for the camera will cause it to not go through the ground.
Cameras don’t have checkCollisions AFAIK. Do you mean wrapping the camera in a mesh, and setting the mesh’s checkCollisions?
What type of camera is it? Can you make a quick and dirty PG?
I believe it’s the other way round. Parent a mesh to the camera and use this mesh for collision check.