function surroundingBoids(boid, surrounding_distance){

	let res = []
	let boidPosition = new THREE.Vector3(boid.position.x,boid.position.y,boid.position.z)
	var currentBoid, currentBoidPosition, distance
	
	for (let i=0;i<boids.children.length;i++){

		currentBoid = boids.children[i]

		if (currentBoid != boid){

			currentBoidPosition = new THREE.Vector3(currentBoid.position.x,currentBoid.position.y,currentBoid.position.z)
			distance = boidPosition.distanceTo(currentBoidPosition)

			if (distance <= surrounding_distance){
				res.push(currentBoid)
			}
		} 
	}
	return res
}
// Return all the boids surrounding boid (distance from boid inferior to surrounding_distance)
Return all the boids surrounding boid (distance from boid inferior to surrounding_distance)
Return all the boids surrounding boid ( distance from boid inferior to surrounding_distance )
function surroundingBoids(boid, surrounding_distance){
	let res = []
	let boidPosition = new THREE.Vector3(boid.position.x,boid.position.y,boid.position.z)
	var currentBoid, currentBoidPosition, distance
	for (let i=0;i<boids.children.length;i++){
		currentBoid = boids.children[i]
		if (currentBoid != boid){
			currentBoidPosition = new THREE.Vector3(currentBoid.position.x,currentBoid.position.y,currentBoid.position.z)
			distance = boidPosition.distanceTo(currentBoidPosition)
			if (distance <= surrounding_distance){
				res.push(currentBoid)
			}
		} 
	}
	return res
}
function surroundingBoids ( boid , surrounding_distance ) { let res = [ ] let boidPosition = new THREE . Vector3 ( boid . position . x , boid . position . y , boid . position . z ) var currentBoid , currentBoidPosition , distance for ( let i = 0 ; i < boids . children . length ; i ++ ) { currentBoid = boids . children [ i ] if ( currentBoid != boid ) { currentBoidPosition = new THREE . Vector3 ( currentBoid . position . x , currentBoid . position . y , currentBoid . position . z ) distance = boidPosition . distanceTo ( currentBoidPosition ) if ( distance <= surrounding_distance ) { res . push ( currentBoid ) } } } return res }
Return all the boids surrounding boid (distance from boid inferior to surrounding_distance)
Return all the boids surrounding boid ( distance from boid inferior to surrounding_distance )