import Vector from '../../math/Vector'; import Location from '../../utils/Location'; import Limiter from '../Limiter'; import Steerable from '../Steerable'; import SteeringBehavior from '../SteeringBehavior'; import SteeringAcceleration from '../SteeringAcceleration'; /** * {@code ReachOrientation} tries to align the owner to the target. It pays no attention to the position or velocity of the owner * or target. This steering behavior does not produce any linear acceleration; it only responds by turning. *

* {@code ReachOrientation} behaves in a similar way to {@link Arrive} since it tries to reach the target orientation and tries to * have zero rotation when it gets there. Like arrive, it uses two radii: {@code decelerationRadius} for slowing down and * {@code alignTolerance} to make orientations near the target acceptable without letting small errors keep the owner swinging. * Because we are dealing with a single scalar value, rather than a 2D or 3D vector, the radius acts as an interval. *

* Similarly to {@code Arrive}, there is a {@code timeToTarget} that defaults to 0.1 seconds. * * @param Type of vector, either 2D or 3D, implementing the {@link Vector} interface * * @author davebaol */ declare class ReachOrientation> extends SteeringBehavior { /** The target to align to. */ protected target: Location; /** The tolerance for aligning to the target without letting small errors keep the owner swinging. */ protected alignTolerance: number; /** The radius for beginning to slow down */ protected decelerationRadius: number; /** The time over which to achieve target rotation speed */ protected timeToTarget: number; /** * Creates a {@code ReachOrientation} behavior for the specified owner and target. * @param owner the owner of this behavior * @param target the target. */ constructor(owner: Steerable, target?: Location); /** Returns the target to align to. */ getTarget(): Location; /** * Sets the target to align to. * @return this behavior for chaining. */ setTarget(target: Location): ReachOrientation; /** Returns the tolerance for aligning to the target without letting small errors keep the owner swinging. */ getAlignTolerance(): number; /** * Sets the tolerance for aligning to the target without letting small errors keep the owner swinging. * @return this behavior for chaining. */ setAlignTolerance(alignTolerance: number): ReachOrientation; /** Returns the radius for beginning to slow down */ getDecelerationRadius(): number; /** * Sets the radius for beginning to slow down * @return this behavior for chaining. */ setDecelerationRadius(decelerationRadius: number): ReachOrientation; /** Returns the time over which to achieve target rotation speed */ getTimeToTarget(): number; /** * Sets the time over which to achieve target rotation speed * @return this behavior for chaining. */ setTimeToTarget(timeToTarget: number): ReachOrientation; setOwner(owner: Steerable): ReachOrientation; setEnabled(enabled: boolean): ReachOrientation; /** * Sets the limiter of this steering behavior. The given limiter must at least take care of the maximum angular speed and * acceleration. * @return this behavior for chaining. */ setLimiter(limiter: Limiter): ReachOrientation; protected calculateRealSteering(steering: SteeringAcceleration): SteeringAcceleration; /** * Produces a steering that tries to align the owner to the target orientation. This method is called by subclasses that want * to align to a certain orientation. * @param steering the steering to be calculated. * @param targetOrientation the target orientation you want to align to. * @return the calculated steering for chaining. */ protected reachOrientation(steering: SteeringAcceleration, targetOrientation: number): SteeringAcceleration; } export default ReachOrientation;