-
-
Save ayamflow/462190f13eeef04f01cb to your computer and use it in GitHub Desktop.
Three.js - get visible width/height in pixels for an object
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
// http://stackoverflow.com/a/13351534 | |
var vFOV = this.camera.fov * Math.PI / 180;; | |
var h = 2 * Math.tan( vFOV / 2 ) * this.camera.position.z; | |
var aspect = width / height; | |
var w = h * aspect; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this. And to get the actual object size you would do this (assuming your canvas is full width and height):