Frustum.intersectsSprite()
The Frustum.intersectsSprite()
method is a method of the Frustum
class in the three.js
library. It is used to test whether a sprite is visible within the frustum.
Frustum.intersectsSprite(sprite: Sprite): Boolean
sprite
is a Sprite
object.Boolean
returns true
if the sprite is visible within the frustum, otherwise it returns false
.A Frustum
object is used to define the viewable region of the camera. It is used to determine which objects are visible within the camera's view. The Frustum.intersectsSprite()
method determines whether a given sprite is visible within the camera's view.
// create a sprite
const sprite = new THREE.Sprite(material);
// create a frustum
const frustum = new THREE.Frustum();
// set the frustum's matrix to the camera's projection matrix
frustum.setFromProjectionMatrix(camera.projectionMatrix);
// test whether the sprite is visible within the frustum
const isVisible = frustum.intersectsSprite(sprite);
Sprite
objects, not for other types of objects.position
and scale
properties.