public final class Agent<T> extends GameEntity
acceleration, hitPoints, id, mass, maxForce, maxMoveSpeed, radius, rotationSpeed, velocity| Constructor and Description |
|---|
Agent() |
Agent(com.jme3.scene.Spatial spatial) |
Agent(java.lang.String name) |
Agent(java.lang.String name,
com.jme3.scene.Spatial spatial) |
| Modifier and Type | Method and Description |
|---|---|
float |
computeNearestApproachPositions(Agent agent,
float time)
Given the time until nearest approach (predictNearestApproachTime)
determine position of each vehicle at that time, and the distance between
them.
|
float |
computeNearestApproachPositions(GameEntity gameEntity,
float time,
com.jme3.math.Vector3f ourPositionAtNearestApproach,
com.jme3.math.Vector3f hisPositionAtNearestApproach)
Given the time until nearest approach (predictNearestApproachTime)
determine position of each vehicle at that time, and the distance between
them.
|
protected void |
controlUpdate(float tpf) |
com.jme3.renderer.Camera |
getCamera() |
Inventory |
getInventory() |
Behavior |
getMainBehavior() |
T |
getModel() |
java.lang.String |
getName() |
Team |
getTeam() |
boolean |
inBoidNeighborhood(GameEntity neighbour,
float minDistance,
float maxDistance,
float maxAngle)
Check if this agent is considered in the same "neighborhood" in relation
with another agent.
|
boolean |
isSameTeam(Agent agent)
Check if this agent is in same team as another agent.
|
float |
predictNearestApproachTime(GameEntity gameEntity)
Given two vehicles, based on their current positions and velocities,
determine the time until nearest approach.
|
void |
setCamera(com.jme3.renderer.Camera camera)
Setting camera for agent.
|
void |
setInventory(Inventory inventory)
Setting inventory system for agent to use.
|
void |
setMainBehavior(Behavior mainBehavior)
Setting main behavior to agent.
|
void |
setModel(T model) |
void |
setTeam(Team team) |
void |
start()
Method for starting agent.
|
void |
stop()
Method for stoping agent.
|
java.lang.String |
toString() |
controlRender, distanceFromPosition, distanceRelativeToGameEntity, distanceSquaredFromPosition, distanceSquaredRelativeToGameEntity, equals, fordwardVector, forwardness, forwardness, getAcceleration, getHitPoints, getId, getLocalRotation, getLocalTranslation, getMass, getMaxForce, getMaxMoveSpeed, getMoveSpeed, getPredictedPosition, getRadius, getRotationSpeed, getVelocity, hashCode, offset, offset, setAcceleration, setHitPoints, setId, setLocalRotation, setLocalTranslation, setLocalTranslation, setMass, setMaxForce, setMaxMoveSpeed, setMoveSpeed, setRadius, setRotationSpeed, setVelocity, validateRadiuspublic Agent()
public Agent(java.lang.String name)
name - name of agentpublic Agent(com.jme3.scene.Spatial spatial)
spatial - spatial that will agent have durring gamepublic Agent(java.lang.String name,
com.jme3.scene.Spatial spatial)
name - name of agentspatial - spatial that will agent have durring gamepublic Behavior getMainBehavior()
public void setMainBehavior(Behavior mainBehavior)
mainBehavior - SimpleMainBehaviorpublic java.lang.String getName()
public void start()
AbstractControl.enabledpublic void stop()
AbstractControl.enabledpublic T getModel()
public void setModel(T model)
model - of agentprotected void controlUpdate(float tpf)
controlUpdate in class com.jme3.scene.control.AbstractControlpublic Team getTeam()
public void setTeam(Team team)
team - in which agent belongspublic boolean isSameTeam(Agent agent)
agent - public com.jme3.renderer.Camera getCamera()
public void setCamera(com.jme3.renderer.Camera camera)
camera - public Inventory getInventory()
public void setInventory(Inventory inventory)
inventory - public boolean inBoidNeighborhood(GameEntity neighbour, float minDistance, float maxDistance, float maxAngle)
GameEntity - The other agentminDistance - Min. distance to be in the same "neighborhood"maxDistance - Max. distance to be in the same "neighborhood"maxAngle - Max angle in radiansSteeringExceptions.NegativeValueException - If minDistance or
maxDistance is lower than 0public float predictNearestApproachTime(GameEntity gameEntity)
gameEntity - Other gameEntitypublic float computeNearestApproachPositions(Agent agent, float time)
agent - Other agenttime - The time until nearest approachAgent#predictNearestApproachTime(com.jme3.ai.agents.Agent)public float computeNearestApproachPositions(GameEntity gameEntity, float time, com.jme3.math.Vector3f ourPositionAtNearestApproach, com.jme3.math.Vector3f hisPositionAtNearestApproach)
gameEntity - Other gameEntitytime - The time until nearest approachourPositionAtNearestApproach - Pointer to a vector, This bector will
be changed to our position at nearest approachhisPositionAtNearestApproach - Pointer to a vector, This bector will
be changed to other position at nearest approachAgent#predictNearestApproachTime(com.jme3.ai.agents.Agent)public java.lang.String toString()
toString in class GameEntity