Created
June 20, 2020 10:25
-
-
Save AlainBarrios/d2bc85d90427ce02ad54426df49c6d15 to your computer and use it in GitHub Desktop.
Get the viewport size to give the plane full size
This file contains 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
const getViewSize = () => { | |
const fov = THREE.Math.degToRad(camera.fov); | |
const dist = camera.position.z - plane.position.z; | |
const height = 2 * Math.tan(fov / 2) * dist; | |
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