raycast method

void raycast(
  1. Raycaster raycaster,
  2. List<Intersection> intersects
)
override

Get intersections between a casted ray and this mesh. Raycaster.intersectObject will call this method, but the results are not ordered.

Implementation

void raycast(Raycaster raycaster, List<Intersection> intersects ) {
	final material = this.material;
	final matrixWorld = this.matrixWorld;

	if ( material == null ) return;

	// test with bounding sphere in world space

	if ( this.boundingSphere == null ) this.computeBoundingSphere();

	_sphere.setFrom( this.boundingSphere! );
	_sphere.applyMatrix4( matrixWorld );

	if ( raycaster.ray.intersectsSphere( _sphere ) == false ) return;

	// convert ray to local space of skinned mesh

	_inverseMatrix.setFrom( matrixWorld ).invert();
	_ray.copyFrom( raycaster.ray ).applyMatrix4( _inverseMatrix );

	// test with bounding box in local space

	if ( this.boundingBox != null ) {
		if ( _ray.intersectsBox( this.boundingBox! ) == false ) return;
	}

	// test for intersections with geometry

	this.computeIntersections( raycaster, intersects, _ray );
}