public abstract class AbstractSteeringBehavior extends Behavior
Modifier and Type | Field and Description |
---|---|
protected float |
timePerFrame
Time per frame.
|
protected com.jme3.math.Vector3f |
velocity
Velocity of our agent.
|
Constructor and Description |
---|
AbstractSteeringBehavior(Agent agent) |
AbstractSteeringBehavior(Agent agent,
com.jme3.scene.Spatial spatial) |
Modifier and Type | Method and Description |
---|---|
protected float |
agentTotalMass()
Method for calculating agent total mass.
|
protected com.jme3.math.Vector3f |
calculateNewVelocity()
Method for calculating new velocity of agent based on steering vector.
|
protected abstract com.jme3.math.Vector3f |
calculateSteering()
Method for calculating steering vector.
|
protected void |
controlUpdate(float tpf)
Usual update pattern for steering behaviors.
|
protected java.util.List<GameEntity> |
convertToGameEntities(java.util.List<Agent> agents)
Convenience method for converting list of agents to list of entities.
|
float |
getBrakingFactor() |
float |
getTimePerFrame() |
com.jme3.math.Vector3f |
getVelocity() |
protected void |
rotateAgent(float tpf)
Method for rotating agent in direction of velocity of agent.
|
protected void |
setBrakingFactor(float brakingFactor)
Note that 0 means the maximum braking force and 1 No braking force
|
void |
setTimePerFrame(float timePerFrame) |
void |
setVelocity(com.jme3.math.Vector3f velocity)
Setting current velocity of agent.
|
controlRender
protected com.jme3.math.Vector3f velocity
protected float timePerFrame
public AbstractSteeringBehavior(Agent agent)
public AbstractSteeringBehavior(Agent agent, com.jme3.scene.Spatial spatial)
protected abstract com.jme3.math.Vector3f calculateSteering()
protected com.jme3.math.Vector3f calculateNewVelocity()
calculateSteering()
protected void rotateAgent(float tpf)
tpf
- time per frameprotected float agentTotalMass()
public com.jme3.math.Vector3f getVelocity()
public void setVelocity(com.jme3.math.Vector3f velocity)
velocity
- protected final void setBrakingFactor(float brakingFactor)
SteeringExceptions.IllegalIntervalException
- If the braking factor is not contained
in the [0,1] intervalpublic final float getBrakingFactor()
protected void controlUpdate(float tpf)
controlUpdate
in class com.jme3.scene.control.AbstractControl
tpf
- public float getTimePerFrame()
public void setTimePerFrame(float timePerFrame)
protected java.util.List<GameEntity> convertToGameEntities(java.util.List<Agent> agents)
agents
-