public class Agent<T> extends GameObject
Modifier and Type | Class and Description |
---|---|
static class |
Agent.AgentWithNegativeRadius |
static class |
Agent.inNeighborhoodInvalidDistances |
acceleration, hitPoint, mass, maxForce, maxHitPoint, maxMoveSpeed, moveSpeed, rotationSpeed, velocity
Constructor and Description |
---|
Agent(java.lang.String name) |
Agent(java.lang.String name,
float radius) |
Agent(java.lang.String name,
com.jme3.scene.Spatial spatial) |
Agent(java.lang.String name,
com.jme3.scene.Spatial spatial,
float radius) |
Modifier and Type | Method and Description |
---|---|
float |
computeNearestApproachPositions(Agent other,
float time)
"Given the time until nearest approach (predictNearestApproachTime)
determine position of each vehicle at that time, and the distance
between them"
|
float |
computeNearestApproachPositions(Agent other,
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"
Anotates the positions at nearest approach in the given vectors. |
protected void |
controlRender(com.jme3.renderer.RenderManager rm,
com.jme3.renderer.ViewPort vp) |
protected void |
controlUpdate(float tpf) |
float |
distanceFromPos(com.jme3.math.Vector3f pos) |
float |
distanceRelativeToAgent(Agent agent) |
float |
distanceSquaredFromPos(com.jme3.math.Vector3f pos) |
float |
distanceSquaredRelativeToAgent(Agent agent) |
boolean |
equals(java.lang.Object obj) |
com.jme3.math.Vector3f |
fordwardVector() |
float |
forwardness(Agent agent)
Calculates the forwardness in relation with another agent.
|
float |
forwardness(com.jme3.math.Vector3f offsetVector) |
com.jme3.renderer.Camera |
getCamera() |
Behaviour |
getMainBehaviour() |
T |
getModel() |
java.lang.String |
getName() |
com.jme3.math.Vector3f |
getPredictedPosition() |
float |
getRadius() |
Team |
getTeam() |
float |
getVisibilityRange() |
AbstractWeapon |
getWeapon() |
int |
hashCode() |
boolean |
inBoidNeighborhood(Agent 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.
|
com.jme3.math.Vector3f |
offset(Agent agent) |
com.jme3.math.Vector3f |
offset(com.jme3.math.Vector3f positionVector) |
float |
predictNearestApproachTime(Agent other)
"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 |
setMainBehaviour(Behaviour mainBehaviour)
Setting main behaviour to agent.
|
void |
setModel(T model) |
void |
setTeam(Team team) |
void |
setVisibilityRange(float visibilityRange) |
void |
setWeapon(AbstractWeapon weapon)
It will add weapon to agent and add its spatial to agent, if there
already was weapon before with its own spatial, it will remove it before
adding new weapon spatial.
|
void |
start()
Method for starting agent.
|
decreaseHitPoints, getAcceleration, getHitPoint, getLocalRotation, getLocalTranslation, getMass, getMaxForce, getMaxHitPoint, getMaxMoveSpeed, getMoveSpeed, getRotationSpeed, getVelocity, increaseHitPoint, setAcceleration, setHitPoint, setLocalRotation, setLocalTranslation, setLocalTranslation, setMass, setMaxForce, setMaxHitPoint, setMaxMoveSpeed, setMoveSpeed, setRotationSpeed, setVelocity
public Agent(java.lang.String name)
name
- unique name/id of agentpublic Agent(java.lang.String name, com.jme3.scene.Spatial spatial)
name
- unique name/id of agentspatial
- spatial that will agent have durring gamepublic Agent(java.lang.String name, float radius)
radius
- Size of bounding sphere, for steer behavioursname
- unique name/id of agentAgent.AgentWithNegativeRadius
- If the radius is lower than 0public Agent(java.lang.String name, com.jme3.scene.Spatial spatial, float radius)
public float getRadius()
public AbstractWeapon getWeapon()
public void setWeapon(AbstractWeapon weapon)
weapon
- that agent will usepublic Behaviour getMainBehaviour()
public void setMainBehaviour(Behaviour mainBehaviour)
mainBehaviour
- SimpleMainBehaviour
public java.lang.String getName()
public void start()
AbstractControl.enabled
public float getVisibilityRange()
public void setVisibilityRange(float visibilityRange)
visibilityRange
- how far agent can seepublic T getModel()
public void setModel(T model)
model
- of agentpublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
protected void controlUpdate(float tpf)
controlUpdate
in class com.jme3.scene.control.AbstractControl
public com.jme3.math.Vector3f getPredictedPosition()
protected void controlRender(com.jme3.renderer.RenderManager rm, com.jme3.renderer.ViewPort vp)
controlRender
in class com.jme3.scene.control.AbstractControl
public 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 boolean inBoidNeighborhood(Agent neighbour, float minDistance, float maxDistance, float MaxAngle)
Agent
- The other agentminDistance
- Min. distance to be in the same "neighborhood"maxDistance
- Max. distance to be in the same "neighborhood"MaxAngle
- Max angle in radiansAgent.inNeighborhoodInvalidDistances
- If minDistance or maxDistance is lower than 0public float forwardness(Agent agent)
agent
- Other agentpublic com.jme3.math.Vector3f fordwardVector()
public float forwardness(com.jme3.math.Vector3f offsetVector)
positionVector
- Offset vector.public float distanceRelativeToAgent(Agent agent)
agent
- Other agentpublic float distanceSquaredRelativeToAgent(Agent agent)
agent
- Other agentpublic float distanceFromPos(com.jme3.math.Vector3f pos)
pos
- Positionpublic float distanceSquaredFromPos(com.jme3.math.Vector3f pos)
pos
- Positionpublic com.jme3.math.Vector3f offset(Agent agent)
agent
- Other agentpublic com.jme3.math.Vector3f offset(com.jme3.math.Vector3f positionVector)
agent
- Other agentpublic float predictNearestApproachTime(Agent other)
agent
- Other agentpublic float computeNearestApproachPositions(Agent other, float time)
agent
- Other agenttime
- The time until nearest approachpredictNearestApproachTime(com.jme3.ai.agents.Agent)
public float computeNearestApproachPositions(Agent other, float time, com.jme3.math.Vector3f ourPositionAtNearestApproach, com.jme3.math.Vector3f hisPositionAtNearestApproach)
agent
- Other agenttime
- 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 approachpredictNearestApproachTime(com.jme3.ai.agents.Agent)