public class AutoPilot extends java.lang.Object implements java.lang.Cloneable, SBF
WALL_AVOID OBSTACLE_AVOID EVADE FLEE SEPARATION
ALIGNMENT COHESION SEEK ARRIVE WANDER
PURSUIT OFFSET_PURSUIT INTERPOSE HIDE PATH
FLOCK
WEIGHTED WEIGHTED_PRIORITIZED
AGENT0 AGENT1 AGENT_TO_PURSUE AGENT_TO_FLEE
AGENT_TO_EVADE, AGENT_TO_PURSUE, AGENT0, AGENT1, ALIGNMENT, ALL_SB_MASK, ARRIVE, BIT_ALIGNMENT, BIT_ARRIVE, BIT_COHESION, BIT_EVADE, BIT_FLEE, BIT_FLOCK, BIT_HIDE, BIT_INTERPOSE, BIT_OBSTACLE_AVOID, BIT_OFFSET_PURSUIT, BIT_PATH, BIT_PURSUIT, BIT_SEEK, BIT_SEPARATION, BIT_WALL_AVOID, BIT_WANDER, COHESION, DECEL_TWEEK, EVADE, FAST, FLEE, FLOCK, HIDE, INTERPOSE, NBR_AGENT_ARRAY, NORMAL, OBSTACLE_AVOID, OFFSET_PURSUIT, PASS_THROUGH, PATH, PURSUIT, REBOUND, SEEK, SEPARATION, SLOW, WALL_AVOID, WANDER, WEIGHTED, WEIGHTED_PRIORITIZED, WRAP
Constructor and Description |
---|
AutoPilot() |
Modifier and Type | Method and Description |
---|---|
AutoPilot |
alignmentOff()
Switch off alignment
|
AutoPilot |
alignmentOn()
Switch on alignment
|
double |
alignmentWeight()
Get the weighting for this behaviour
|
AutoPilot |
alignmentWeight(double weight)
Set the weight for this behaviour
|
AutoPilot |
allOff()
Switch off all steering behaviours
|
double |
arriveDistance()
Get current distance from the owning entity to the arrive target position.
|
AutoPilot |
arriveOff()
Switch off arrive
|
AutoPilot |
arriveOn()
Switch on arrive
|
AutoPilot |
arriveOn(double x,
double y)
Switch on arrive
|
AutoPilot |
arriveOn(double x,
double y,
int speed)
Switch on arrive and define speed of approach.
|
AutoPilot |
arriveOn(Vector2D target)
Switch on arrive.
|
AutoPilot |
arriveOn(Vector2D target,
int speed)
Switch on arrive and define speed of approach.
|
double |
arriveWeight()
Get the weighting for this behaviour
|
AutoPilot |
arriveWeight(double weight)
Set the weight for this behaviour
|
Vector2D |
calculateForce(double deltaTime,
World world)
Calculates (according to selected calculation method) the steering forces from
any active behaviours.
|
int |
calculateMethod()
Find out which method is being used for calculating the steering force.
|
AutoPilot |
calculateMethod(int method)
Set which method is to be used for calculating the steering force, options are
|
java.lang.Object |
clone()
Creates and returns an 'available' (auto-pilot object that can be
used in another Vehicle) copy of this object.
|
AutoPilot |
cohesionOff()
Switch off cohesion
|
AutoPilot |
cohesionOn()
Switch on cohesion
|
double |
cohesionWeight()
Get the weighting for this behaviour
|
AutoPilot |
cohesionWeight(double weight)
Set the weight for this behaviour
|
double |
evadeDistance()
Get current distance from the owning entity and the moving entity
we want to evade.
|
AutoPilot |
evadeFactors(double fleeDistance)
Set the factors used for evade behaviour.
|
AutoPilot |
evadeOff()
Switch off evade pursuer
|
AutoPilot |
evadeOn()
Switch on evade pursuer
|
AutoPilot |
evadeOn(MovingEntity me)
Switch on evade pursuer and specify the entity to avoid.
|
double |
evadeWeight()
Get the weighting for this behaviour
|
AutoPilot |
evadeWeight(double weight)
Set the weight for this behaviour
|
double |
fleeDistance()
Get current distance from the owning entity to the flee target position.
|
AutoPilot |
fleeFactors(double fleeDistance)
Set the factors used for flee behaviour agent.
|
AutoPilot |
fleeOff()
Switch off flee
|
AutoPilot |
fleeOn()
Switch on flee
|
AutoPilot |
fleeOn(double x,
double y)
Switch on flee
|
AutoPilot |
fleeOn(Vector2D location)
Switch on flee
|
double |
fleeRadius()
The effective range of the flee target.
|
AutoPilot |
fleeRadius(double fleeRadius)
The flee force applied will be zero if the entity is outside
the flee radius
|
double |
fleeWeight()
Get the weighting for this behaviour
|
AutoPilot |
fleeWeight(double weight)
Set the weight for this behaviour
|
AutoPilot |
flockFactors(double neighbourhoodRadius)
Sets the radius for ALL the group behaviours (separation, alignment
and cohesion) even if you are using them without flocking.
|
AutoPilot |
flockOff()
Switch off flock
|
AutoPilot |
flockOn()
Switch on flock
|
double |
flockWeight()
Get the weighting for this behaviour
|
AutoPilot |
flockWeight(double weight)
Set the weight for this behaviour
|
Vector2D[] |
getFeelers()
FOR INTERNAL USE ONLY
Calculates and returns an array of feelers around the vehicle that owns this steering behaviour. |
Vector2D[] |
getFeelers(MovingEntity me)
Calculates and returns an array of feelers arround the specified
moving entity using the whisker details in this steering behaviour.
|
Vector2D[] |
getFeelers(Vector2D facing,
Vector2D origin)
Calculates and returns an array of feelers around the vehicle that
owns this steering behaviour using the specified heading and origin.
|
double |
getWeight(int behaviour)
Get the weighting for a single behaviour.
|
boolean |
hasOwner()
Used to see if this auto-pilot has an owner.
|
double |
hideDistance()
Get current distance from the owning entity and the moving entity
we want are hiding from.
|
AutoPilot |
hideOff()
Switch off hide
|
AutoPilot |
hideOn()
Switch on hide
|
AutoPilot |
hideOn(MovingEntity me) |
double |
hideWeight()
Get the weighting for this behaviour
|
AutoPilot |
hideWeight(double weight)
Set the weight for this behaviour
|
AutoPilot |
interposeOff()
Switch off interpose
|
AutoPilot |
interposeOn()
Switch on interpose
|
AutoPilot |
interposeOn(MovingEntity me0,
MovingEntity me1)
Switch on interpose and specify the two moving entities
to get between.
|
AutoPilot |
interposeOn(MovingEntity me0,
Vector2D fixedPos1)
Switch on interpose and specify a moving entity and a fixed point
in the world to get between.
|
AutoPilot |
interposeOn(Vector2D fixedPos0,
Vector2D fixedPos1)
Switch on interpose and specify two fixed points
in the world to get between.
|
double |
interposeWeight()
Get the weighting for this behaviour
|
AutoPilot |
interposeWeight(double weight)
Set the weight for this behaviour
|
boolean |
isAlignmentOn()
Is alignment switched on?
|
boolean |
isArriveOn()
Is arrive switched on?
|
boolean |
isCohesionOn()
Is cohesion switched on?
|
boolean |
isEvadeOn()
Is evade switched on?
|
boolean |
isFleeOn()
Is seek switched on?
|
boolean |
isFlockOn()
Is flock switched on?
|
boolean |
isHideOn()
Is hide switched on?
|
boolean |
isInterposeOn()
Is interpose switched on?
|
boolean |
isObstacleAvoidOn()
Is wall avoidance switched on?
|
boolean |
isOffsetPursuitOn()
Is offsetPursuit switched on?
|
boolean |
isPathOn()
Is path switched on?
|
boolean |
isPursuitOn()
Is pursuit switched on?
|
boolean |
isSeekOn()
Is seek switched on?
|
boolean |
isSeparationOn()
Is separation switched on?
|
boolean |
isWallAvoidOn()
Is wall avoidance switched on?
|
boolean |
isWallAvoidOvalEnvelopeOn()
If on then the side whiskers are smaller than the front whiskers.
|
boolean |
isWanderOn()
Is wander switched on?
|
double |
obstacleAvoidDetectBoxLength()
Only provided to enable drawing the box during testing.
|
AutoPilot |
obstacleAvoidDetectBoxLength(double boxLength)
Set the obstacle avoidance detection box length.
|
AutoPilot |
obstacleAvoidFactors(double detectBoxLength)
Set the factors used for obstacle avoidance.
|
AutoPilot |
obstacleAvoidOff()
Switch off obstacle avoidance
|
AutoPilot |
obstacleAvoidOn()
Switch on obstacle avoidance
|
double |
obstacleAvoidWeight()
Get the weighting for this behaviour
|
AutoPilot |
obstacleAvoidWeight(double weight)
Set the weight for this behaviour
|
AutoPilot |
offsetPursuitOff()
Switch off offsetPursuit
|
AutoPilot |
offsetPursuitOn()
Switch on offsetPursuit
|
AutoPilot |
offsetPursuitOn(MovingEntity me,
Vector2D offset)
Set the target enitiy for offsetPursuit and the offset.
|
double |
offsetPursuitWeight()
Get the weighting for this behaviour
|
AutoPilot |
offsetPursuitWeight(double weight)
Set the weight for this behaviour
|
AutoPilot |
pathAddToRoute(Graph graph,
GraphNode dest)
Calculate and add the route from the end of the existing path (or the nearest node if
there is no existing path) to the dest Node.
|
AutoPilot |
pathAddToRoute(java.util.List<GraphNode> route)
Add the route to the end of the existing path.
|
AutoPilot |
pathAddToRoute(Vector2D waypoint)
Add the waypoint to the end of the existing path and switch path following on.
|
AutoPilot |
pathAddToRoute(Vector2D[] route)
Add the route to the end of the existing path and switch path following on.
|
AutoPilot |
pathFactors(java.lang.Object seekDist,
java.lang.Object arriveDist) |
GraphNode |
pathNextNode()
Get the node the entity is currently moving towards.
|
AutoPilot |
pathOff()
Switch off path
|
AutoPilot |
pathOn()
Switch on path
|
java.util.LinkedList<GraphNode> |
pathRoute()
Get the path the entity is following
|
int |
pathRouteLength()
Get the number of way-points left on the current route
|
AutoPilot |
pathSetRoute(java.util.List<GraphNode> route)
Set the path the entity should follow.
|
AutoPilot |
pathSetRoute(Vector2D[] route)
Set the path the entity should follow.
|
double |
pathWeight()
Get the weighting for this behaviour
|
AutoPilot |
pathWeight(double weight)
Set the weight for this behaviour
|
double |
pursuitDistance()
Get current distance from the owning entity and the moving entity
we want are pursuing.
|
AutoPilot |
pursuitOff()
Switch off pursuit pursuer
|
AutoPilot |
pursuitOn()
Switch on pursuit pursuer
|
AutoPilot |
pursuitOn(MovingEntity me)
Switch on pursuit and specify the entity to persue.
|
double |
pursuitWeight()
Get the weighting for this behaviour
|
AutoPilot |
pursuitWeight(double weight)
Set the weight for this behaviour
|
double |
seekDistance()
Get current distance from the owning entity to the seek target position.
|
AutoPilot |
seekOff()
Switch off seek
|
AutoPilot |
seekOn()
Switch on seek
|
AutoPilot |
seekOn(double x,
double y)
Switch on seek
|
AutoPilot |
seekOn(Vector2D target)
Switch on seek
|
double |
seekWeight()
Get the weighting for this behaviour
|
AutoPilot |
seekWeight(double weight)
Set the weight for this behaviour
|
AutoPilot |
separationOff()
Switch off separation
|
AutoPilot |
separationOn()
Switch on separation
|
double |
separationWeight()
Get the weighting for this behaviour
|
AutoPilot |
separationWeight(double weight)
Set the weight for this behaviour
|
AutoPilot |
setOwner(Vehicle vehicle)
DO NOT USE THIS METHOD
This method is for sole use by the Vehicle class when a steering behaviour is added. |
java.lang.String |
toString()
This method provides a String object that describes the active behaviours and their details.
|
AutoPilot |
wallAvoidFactors(java.lang.Object nbrWhiskers,
java.lang.Object whiskerLength,
java.lang.Object fov,
java.lang.Boolean shortOnSide)
Set some or all of the factors used for wall avoidance.
|
double |
wallAvoidFOV()
Get the angle covered by the whiskers
|
int |
wallAvoidNbrWhiskers()
Get the number of whiskers used.
|
AutoPilot |
wallAvoidOff()
Switch off wall avoidance
|
AutoPilot |
wallAvoidOn()
Switch on wall avoidance
|
double |
wallAvoidWeight()
Get the weighting for this behaviour
|
AutoPilot |
wallAvoidWeight(double weight)
Set the weight for this behaviour
|
double |
wallAvoidWhiskerLength()
Get the length of the whiskers
|
double |
wanderAngle()
Gets the current angle in the wander radius circle
|
double |
wanderAngleDelta() |
double |
wanderAngleJitter()
Gets the maximum amount of jitter allowed per second
|
double |
wanderDist() |
AutoPilot |
wanderFactors(java.lang.Object dist,
java.lang.Object radius,
java.lang.Object jitter)
Set some or all of the factors used for wander behaviour.
|
AutoPilot |
wanderOff()
Switch off wander
|
AutoPilot |
wanderOn()
Switch on wander
|
double |
wanderRadius() |
double |
wanderWeight()
Get the weighting for this behaviour
|
AutoPilot |
wanderWeight(double weight)
Set the weight for this behaviour
|
public AutoPilot setOwner(Vehicle vehicle)
vehicle
- public boolean hasOwner()
public AutoPilot allOff()
public AutoPilot wallAvoidOff()
public AutoPilot wallAvoidOn()
public AutoPilot wallAvoidWeight(double weight)
weight
- the weighting to be applied to this behaviour.public double wallAvoidWeight()
public boolean isWallAvoidOn()
public AutoPilot wallAvoidFactors(java.lang.Object nbrWhiskers, java.lang.Object whiskerLength, java.lang.Object fov, java.lang.Boolean shortOnSide)
nbrWhiskers
- the number of feelers to use (>0)whiskerLength
- the length of the feelers (>0)fov
- the arc angle (radians) covered by the feeler array (>0 and <= 2PishortOnSide
- if true then the side feelers are shorter than front facing feelers else all feelers are the same lengthpublic int wallAvoidNbrWhiskers()
public double wallAvoidFOV()
public double wallAvoidWhiskerLength()
public boolean isWallAvoidOvalEnvelopeOn()
public AutoPilot obstacleAvoidOff()
public AutoPilot obstacleAvoidOn()
public AutoPilot obstacleAvoidWeight(double weight)
weight
- the weighting to be applied to this behaviour.public double obstacleAvoidWeight()
public double obstacleAvoidDetectBoxLength()
public AutoPilot obstacleAvoidDetectBoxLength(double boxLength)
boxLength
- new lengthpublic boolean isObstacleAvoidOn()
public AutoPilot obstacleAvoidFactors(double detectBoxLength)
detectBoxLength
- detect box length (>0)public AutoPilot evadeOff()
public AutoPilot evadeOn()
public AutoPilot evadeOn(MovingEntity me)
me
- the entity to evadepublic double evadeDistance()
public AutoPilot evadeWeight(double weight)
weight
- the weighting to be applied to this behaviour.public double evadeWeight()
public boolean isEvadeOn()
public AutoPilot evadeFactors(double fleeDistance)
fleeDistance
- the distance we want to evade by (>0)public AutoPilot seekOff()
public AutoPilot seekOn()
public AutoPilot seekOn(Vector2D target)
target
- the location to seekpublic AutoPilot seekOn(double x, double y)
x
- the x position of the target to seeky
- the y position of the target to seekpublic double seekDistance()
public AutoPilot seekWeight(double weight)
weight
- the weighting to be applied to this behaviour.public double seekWeight()
public boolean isSeekOn()
public AutoPilot arriveOff()
public AutoPilot arriveOn()
public AutoPilot arriveOn(Vector2D target)
target
- the location to arrive atpublic AutoPilot arriveOn(Vector2D target, int speed)
target
- the location to arrive atspeed
- the approach ratepublic AutoPilot arriveOn(double x, double y)
x
- the x position of the target to arrive aty
- the y position of the target to arrive atpublic AutoPilot arriveOn(double x, double y, int speed)
x
- the x position of the target to arrive aty
- the y position of the target to arrive atspeed
- the approach ratepublic double arriveDistance()
public AutoPilot arriveWeight(double weight)
weight
- the weighting to be applied to this behaviour.public double arriveWeight()
public boolean isArriveOn()
public AutoPilot fleeOff()
public AutoPilot fleeOn()
public AutoPilot fleeOn(Vector2D location)
location
- the location to flee frompublic AutoPilot fleeOn(double x, double y)
x
- the x position of the location to flee fromy
- the y position of the location to flee frompublic double fleeDistance()
public AutoPilot fleeRadius(double fleeRadius)
fleeRadius
- public double fleeRadius()
public AutoPilot fleeWeight(double weight)
weight
- the weighting to be applied to this behaviour.public double fleeWeight()
public boolean isFleeOn()
public AutoPilot fleeFactors(double fleeDistance)
fleeDistance
- the distance we want to evade by (>0)public AutoPilot separationOff()
public AutoPilot separationOn()
public AutoPilot separationWeight(double weight)
weight
- the weighting to be applied to this behaviour.public double separationWeight()
public boolean isSeparationOn()
public AutoPilot alignmentOff()
public AutoPilot alignmentOn()
public AutoPilot alignmentWeight(double weight)
weight
- the weighting to be applied to this behaviour.public double alignmentWeight()
public boolean isAlignmentOn()
public AutoPilot cohesionOff()
public AutoPilot cohesionOn()
public AutoPilot cohesionWeight(double weight)
weight
- the weighting to be applied to this behaviour.public double cohesionWeight()
public boolean isCohesionOn()
public AutoPilot flockOff()
public AutoPilot flockOn()
public AutoPilot flockWeight(double weight)
weight
- the weighting to be applied to this behaviour.public double flockWeight()
public boolean isFlockOn()
public AutoPilot flockFactors(double neighbourhoodRadius)
neighbourhoodRadius
- the neighbourhood radiuspublic AutoPilot wanderOff()
public AutoPilot wanderOn()
public AutoPilot wanderWeight(double weight)
weight
- the weighting to be applied to this behaviour.public double wanderWeight()
public boolean isWanderOn()
public AutoPilot wanderFactors(java.lang.Object dist, java.lang.Object radius, java.lang.Object jitter)
dist
- radius
- jitter
- public double wanderRadius()
public double wanderDist()
public double wanderAngle()
public double wanderAngleJitter()
public double wanderAngleDelta()
public AutoPilot pursuitOff()
public AutoPilot pursuitOn()
public AutoPilot pursuitOn(MovingEntity me)
me
- the entity to pursuitpublic double pursuitDistance()
public AutoPilot pursuitWeight(double weight)
weight
- the weighting to be applied to this behaviour.public double pursuitWeight()
public boolean isPursuitOn()
public AutoPilot offsetPursuitOff()
public AutoPilot offsetPursuitOn()
public AutoPilot offsetPursuitOn(MovingEntity me, Vector2D offset)
me
- offset
- public AutoPilot offsetPursuitWeight(double weight)
weight
- the weighting to be applied to this behaviour.public double offsetPursuitWeight()
public boolean isOffsetPursuitOn()
public AutoPilot interposeOff()
public AutoPilot interposeOn()
public AutoPilot interposeOn(MovingEntity me0, MovingEntity me1)
me0
- the first moverme1
- the second moverpublic AutoPilot interposeOn(MovingEntity me0, Vector2D fixedPos1)
me0
- the first moverfixedPos1
- fixed position in the world.public AutoPilot interposeOn(Vector2D fixedPos0, Vector2D fixedPos1)
fixedPos0
- first fixed position in the world.fixedPos1
- second fixed position in the world.public AutoPilot interposeWeight(double weight)
weight
- the weighting to be applied to this behaviour.public double interposeWeight()
public boolean isInterposeOn()
public AutoPilot hideOff()
public AutoPilot hideOn()
public AutoPilot hideOn(MovingEntity me)
public double hideDistance()
public AutoPilot hideWeight(double weight)
weight
- the weighting to be applied to this behaviour.public double hideWeight()
public boolean isHideOn()
public AutoPilot pathOff()
public AutoPilot pathOn()
public AutoPilot pathWeight(double weight)
weight
- the weighting to be applied to this behaviour.public double pathWeight()
public boolean isPathOn()
public AutoPilot pathFactors(java.lang.Object seekDist, java.lang.Object arriveDist)
seekDist
- distance to way-point when considered reachedarriveDist
- distance to destination when considered reachedpublic java.util.LinkedList<GraphNode> pathRoute()
public int pathRouteLength()
public AutoPilot pathSetRoute(Vector2D[] route)
route
- the path to followpublic AutoPilot pathAddToRoute(Vector2D[] route)
route
- the path to followpublic AutoPilot pathAddToRoute(Vector2D waypoint)
waypoint
- add a single waypoint to the routepublic AutoPilot pathSetRoute(java.util.List<GraphNode> route)
route
- the path to followpublic AutoPilot pathAddToRoute(java.util.List<GraphNode> route)
route
- the path to addpublic AutoPilot pathAddToRoute(Graph graph, GraphNode dest)
graph
- dest
- public GraphNode pathNextNode()
public AutoPilot calculateMethod(int method)
SBF.WEIGHTED_AVERAGE (default) or SBF.PRIORITIZEDany other value will be ignored.
method
- the method to usepublic int calculateMethod()
public Vector2D calculateForce(double deltaTime, World world)
deltaTime
- time since last update in secondsworld
- the game world objectpublic Vector2D[] getFeelers()
public Vector2D[] getFeelers(MovingEntity me)
me
- the moving entity needing whiskerspublic Vector2D[] getFeelers(Vector2D facing, Vector2D origin)
facing
- the facing directionorigin
- public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public double getWeight(int behaviour)
behaviour
- should represent a single behaviourProcessing library AI_for_2D_Games by Peter Lager. (C) 2013