Skip to content

Instantly share code, notes, and snippets.

@AndrewRayCode
Created January 1, 2016 05:11
Show Gist options
  • Select an option

  • Save AndrewRayCode/10d7840f8d3aff0892ac to your computer and use it in GitHub Desktop.

Select an option

Save AndrewRayCode/10d7840f8d3aff0892ac to your computer and use it in GitHub Desktop.
function getFrustrumAt( camera, fov, aspect, distanceFromCamera ) {
var frustumHeight = 2.0 * distanceFromCamera * Math.tan(fov * 0.5 * ( Math.PI / 180 ) ),
var box = new THREE.Box2();
var size = new THREE.Vector2( frustumHeight * aspect, frustumHeight );
box.width = size.x;
box.height = size.y;
return box.setFromCenterAndSize( camera.position, new THREE.Vector2(
frustumHeight * aspect
frustumHeight
));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment