neighborhoodRadius 属性指定了 MovingEntity 对象感知其邻居的半径范围。
MovingEntity.neighborhoodRadius = radius;
radius: number类型,表示半径范围。var entity = new MovingEntity();
// 设置邻居半径范围为50
entity.neighborhoodRadius = 50;
在二维空间中,MovingEntity 对象需要知道周围其他对象的位置才能进行一些行为,例如避免碰撞等。它使用 neighborhoodRadius 属性来确定半径范围内的其他对象。如果没有其他对象处于该范围内,该对象将不需要做出任何行动。
设置一个较大的半径范围可能会影响系统的性能。对于不同的应用场景,建议根据实际需求选择合适的半径范围。