de.steeringbehaviors.simulation.behaviors
Class OffsetSeek

java.lang.Object
  extended by de.steeringbehaviors.simulation.behaviors.Behavior
      extended by de.steeringbehaviors.simulation.behaviors.OffsetSeek
All Implemented Interfaces:
ObjectAttributes

public class OffsetSeek
extends Behavior

OffsetSeek Seeks a position relative to a specified target object


Field Summary
protected  double m_activeDistance
          Maximum distance to trigger the behaviour
protected  Vector2d m_offset
          Offset relative to the target object
protected  Geometrie m_target
          Target object
 
Fields inherited from class de.steeringbehaviors.simulation.behaviors.Behavior
m_behaviorName, m_influence, m_needsNeighborhood, m_neighborhood
 
Constructor Summary
OffsetSeek(Geometrie target, double influence)
          Constructor
OffsetSeek(Geometrie target, double x, double y, double influence)
          Constructor
 
Method Summary
 Vector2d calculate(Vehicle veh)
          Calculates the resulting force vector for this frame
 void setActiveDistance(double adistance)
          Sets the maximum distance to the target to trigger the behaviour
 void setAttribute(java.lang.String name, java.lang.String value, java.util.Hashtable objectList)
          Sets a attribute specified by the name
 void setTarget(Geometrie target)
          Sets the current target
 void setTargetXY(double x, double y)
          Sets the current target to a new fixed position
 
Methods inherited from class de.steeringbehaviors.simulation.behaviors.Behavior
getBehaviorName, getInfluence, needsNeighborhood, setInfluence, setNeighborhood, setSpecialObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_target

protected Geometrie m_target
Target object


m_offset

protected Vector2d m_offset
Offset relative to the target object


m_activeDistance

protected double m_activeDistance
Maximum distance to trigger the behaviour

Constructor Detail

OffsetSeek

public OffsetSeek(Geometrie target,
                  double influence)
Constructor

Parameters:
target - Target object
influence - Influence of the behaviour

OffsetSeek

public OffsetSeek(Geometrie target,
                  double x,
                  double y,
                  double influence)
Constructor

Parameters:
target - Target object
x - Relative x target position
y - Relative y target position
influence - Influence of the behaviour
Method Detail

setActiveDistance

public void setActiveDistance(double adistance)
Sets the maximum distance to the target to trigger the behaviour

Parameters:
adistance - New active distance

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value,
                         java.util.Hashtable objectList)
Sets a attribute specified by the name

Specified by:
setAttribute in interface ObjectAttributes
Overrides:
setAttribute in class Behavior
Parameters:
name - name of the attribute
value - value of the attribute
objectList - hashtable of all steeringobjects

setTarget

public void setTarget(Geometrie target)
Sets the current target

Parameters:
target - The new target

setTargetXY

public void setTargetXY(double x,
                        double y)
Sets the current target to a new fixed position

Parameters:
x - X position
y - Y position

calculate

public Vector2d calculate(Vehicle veh)
Calculates the resulting force vector for this frame

Overrides:
calculate in class Behavior
Parameters:
veh - The vehicle
Returns:
Returns the resulting force