Last active
February 1, 2023 10:15
-
-
Save dghez/30c9d4821c5b61c8cee558e85bf24a5d to your computer and use it in GitHub Desktop.
Visible Portion of some element at certain distance, plane.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {MathUtils} from "three"; | |
| // this gives the "visible" plane sizes that is visible from the camera at a certain distance | |
| export default function(distance, camera) { | |
| const vFOV = MathUtils.degToRad(camera.fov); | |
| const height = 2 * Math.tan(vFOV / 2) * distance; | |
| const width = height * camera.aspect; | |
| return { width, height }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment