When mesh.position.z = 0, it is the most visible distance up, down, left, and right in the current pg
Maybe I didn’t describe it very clearly. When the camera position is fixed, I want to know the specific coordinates of the four points in the picture.
You are looking at the camera Frustum.
Maybe start here for what you seek: Frustum | Babylon.js Documentation
Infer your coordinate somehow from the planes?
Hello!
To explain how to deduce this value, first I should talk about the camera frustum. This is what we call the area that is viewed by a camera:
Let’s try to view this frustum on its vertical side (the side with h), it would look something like this:
It’s a bit crooked on my pic, but you can see the triangle formed by camera, target and ymax is a right triangle, so you can use the tangent of half of yfov to calculate half of the target plane’s height:
The same process can be repeated to find the w width of the target plane.
If something is not clear just let me know and I can explain more!
4 Likes
I read your content carefully and thought about my previous understanding of cameras. I understood a lot of things at once. I will give it a try.
Take the case of a special value z=0
// camera pos (0, 0, 150)
// camera target (0, 0, 0)
const camera = this.scene.activeCamera
const yFov = camera.fov / 2 // 0.4
const yMax = camera.position.z * yFov // 60
const yMin = -60
1 Like