/** Creates a {@code CollisionAvoidance} behavior for the specified owner and proximity. * @param owner the owner of this behavior * @param proximity the proximity of this behavior. */ public CollisionAvoidance (Steerable<T> owner, Proximity<T> proximity) { super(owner, proximity); this.firstRelativePosition = newVector(owner); this.firstRelativeVelocity = newVector(owner); this.relativeVelocity = newVector(owner); }
/** Creates a {@code Hide} behavior for the specified owner, target and proximity. * @param owner the owner of this behavior * @param target the target of this behavior * @param proximity the proximity to find nearby obstacles */ public Hide (Steerable<T> owner, Location<T> target, Proximity<T> proximity) { super(owner, target); this.proximity = proximity; this.bestHidingSpot = newVector(owner); this.toObstacle = null; // Set to null since we'll reuse steering.linear for this vector }
/** Creates a {@code Cohesion} for the specified owner and proximity. * @param owner the owner of this behavior. * @param proximity the proximity to detect the owner's neighbors */ public Cohesion (Steerable<T> owner, Proximity<T> proximity) { super(owner, proximity); }
/** Creates a {@code Separation} behavior for the specified owner and proximity. * @param owner the owner of this behavior * @param proximity the proximity to detect the owner's neighbors */ public Separation (Steerable<T> owner, Proximity<T> proximity) { super(owner, proximity); this.toAgent = newVector(owner); }
/** Creates an {@code Alignment} behavior for the specified owner and proximity. * @param owner the owner of this behavior * @param proximity the proximity */ public Alignment (Steerable<T> owner, Proximity<T> proximity) { super(owner, proximity); }
/** Returns the proximity used to find nearby obstacles. */ public Proximity<T> getProximity () { return proximity; }
/** Sets the proximity used to find nearby obstacles. * @param proximity the proximity to set * @return this behavior for chaining. */ public Hide<T> setProximity (Proximity<T> proximity) { this.proximity = proximity; return this; }