src/core/World.js
/**
	* The method checks if compatible game entities intersect with a projectile.
	* The closest hitted game entity is returned. If no intersection is detected,
	* null is returned. A possible intersection point is stored into the second parameter.
	*
	* @param {Projectile} projectile - The projectile.
	* @param {Vector3} intersectionPoint - The intersection point.
	* @return {GameEntity} The hitted game entity.
	*/
The method checks if compatible game entities intersect with a projectile.
The closest hitted game entity is returned. If no intersection is detected,
null is returned. A possible intersection point is stored into the second parameter.

@param {Projectile} projectile - The projectile.
@param {Vector3} intersectionPoint - The intersection point.
@return {GameEntity} The hitted game entity.
The method checks if compatible game entities intersect with a projectile . The closest hitted game entity is returned . If no intersection is detected null is returned . A possible intersection point is stored into the second parameter . @param { Projectile } projectile - The projectile . @param { Vector3 } intersectionPoint - The intersection point . @return { GameEntity } The hitted game entity .
checkProjectileIntersection( projectile, intersectionPoint ) {
		const entities = this.entityManager.entities;
		let minDistance = Infinity;
		let hittedEntity = null;
		const owner = projectile.owner;
		const ray = projectile.ray;
		for ( let i = 0, l = entities.length; i < l; i ++ ) {
			const entity = entities[ i ];
			if ( entity !== owner && entity.active && entity.checkProjectileIntersection ) {
				if ( entity.checkProjectileIntersection( ray, currentIntersectionPoint ) !== null ) {
					const squaredDistance = currentIntersectionPoint.squaredDistanceTo( ray.origin );
					if ( squaredDistance < minDistance ) {
						minDistance = squaredDistance;
						hittedEntity = entity;
						intersectionPoint.copy( currentIntersectionPoint );
					}
				}
			}
		}
		return hittedEntity;
	}
checkProjectileIntersection ( projectile , intersectionPoint ) { const entities = this . entityManager . entities ; let minDistance = Infinity ; let hittedEntity = null ; const owner = projectile . owner ; const ray = projectile . ray ; for ( let i = 0 , l = entities . length ; i < l ; i ++ ) { const entity = entities [ i ] ; if ( entity !== owner && entity . active && entity . checkProjectileIntersection ) { if ( entity . checkProjectileIntersection ( ray , currentIntersectionPoint ) !== null ) { const squaredDistance = currentIntersectionPoint . squaredDistanceTo ( ray . origin ) ; if ( squaredDistance < minDistance ) { minDistance = squaredDistance ; hittedEntity = entity ; intersectionPoint . copy ( currentIntersectionPoint ) ; } } } } return hittedEntity ; }
The method checks if compatible game entities intersect with a projectile.
The method checks if compatible game entities intersect with a projectile .
// do not test with the owner entity and only process entities with the correct interface