I am working with a three.js scene and am interested in determining the 3D boundaries of the viewport.
Imagine a canvas that is 500px wide and 1000px tall. The camera is fixed at position { 0, 0, 100 }
, looking towards the origin at { 0, 0, 0 }
.
The camera's position is static and will not change.
If there is an object located at { 0, 0, 0 }
, I need to be able to move it to different locations within the camera's field of view. How can I calculate the upper-left corner of the field of view, as well as the point that is 20% from the left and 10% from the top of the field of view?
Below is the camera object data:
{
"object": {
"uuid": "E26C5F88-CD17-45F8-A492-F3DD704949BF",
"type": "PerspectiveCamera",
"matrix": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 100, 1],
"zoom": 1,
"fov": 50,
"aspect": 0.625,
"near": 0.1,
"far": 1000
}
}