Package com.mygdx.game.Components
Class AINavigation
- java.lang.Object
-
- com.mygdx.game.Components.Component
-
- com.mygdx.game.Components.AINavigation
-
- All Implemented Interfaces:
com.badlogic.gdx.ai.steer.Limiter
,com.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2>
,com.badlogic.gdx.ai.utils.Location<com.badlogic.gdx.math.Vector2>
public class AINavigation extends Component implements com.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2>
Used to control NPCs with steerable for movement and state machines for behaviour
-
-
Field Summary
-
Fields inherited from class com.mygdx.game.Components.Component
parent, reqsMet, requirements, type
-
-
Constructor Summary
Constructors Constructor Description AINavigation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.badlogic.gdx.math.Vector2
angleToVector(com.badlogic.gdx.math.Vector2 outVector, float angle)
float
getAngularVelocity()
float
getBoundingRadius()
com.badlogic.gdx.math.Vector2
getLinearVelocity()
float
getMaxAngularAcceleration()
float
getMaxAngularSpeed()
float
getMaxLinearAcceleration()
float
getMaxLinearSpeed()
float
getOrientation()
com.badlogic.gdx.math.Vector2
getPosition()
float
getZeroLinearSpeedThreshold()
boolean
isTagged()
com.badlogic.gdx.ai.utils.Location<com.badlogic.gdx.math.Vector2>
newLocation()
void
setBehavior(com.badlogic.gdx.ai.steer.SteeringBehavior<com.badlogic.gdx.math.Vector2> behavior)
void
setMaxAngularAcceleration(float maxAngularAcceleration)
void
setMaxAngularSpeed(float maxAngularSpeed)
void
setMaxLinearAcceleration(float maxLinearAcceleration)
void
setMaxLinearSpeed(float maxLinearSpeed)
void
setOrientation(float orientation)
void
setTagged(boolean tagged)
void
setZeroLinearSpeedThreshold(float value)
void
stop()
Stops all motionvoid
update()
Called once per frame.float
vectorToAngle(com.badlogic.gdx.math.Vector2 vector)
-
-
-
Method Detail
-
setBehavior
public void setBehavior(com.badlogic.gdx.ai.steer.SteeringBehavior<com.badlogic.gdx.math.Vector2> behavior)
-
update
public void update()
Called once per frame. Apply the steering behaviour and sets the ship direction, so it faces the right way
-
stop
public void stop()
Stops all motion
-
getLinearVelocity
public com.badlogic.gdx.math.Vector2 getLinearVelocity()
- Specified by:
getLinearVelocity
in interfacecom.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2>
-
getAngularVelocity
public float getAngularVelocity()
- Specified by:
getAngularVelocity
in interfacecom.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2>
-
getBoundingRadius
public float getBoundingRadius()
- Specified by:
getBoundingRadius
in interfacecom.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2>
-
isTagged
public boolean isTagged()
- Specified by:
isTagged
in interfacecom.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2>
-
setTagged
public void setTagged(boolean tagged)
- Specified by:
setTagged
in interfacecom.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2>
-
getZeroLinearSpeedThreshold
public float getZeroLinearSpeedThreshold()
- Specified by:
getZeroLinearSpeedThreshold
in interfacecom.badlogic.gdx.ai.steer.Limiter
-
setZeroLinearSpeedThreshold
public void setZeroLinearSpeedThreshold(float value)
- Specified by:
setZeroLinearSpeedThreshold
in interfacecom.badlogic.gdx.ai.steer.Limiter
-
getMaxLinearSpeed
public float getMaxLinearSpeed()
- Specified by:
getMaxLinearSpeed
in interfacecom.badlogic.gdx.ai.steer.Limiter
-
setMaxLinearSpeed
public void setMaxLinearSpeed(float maxLinearSpeed)
- Specified by:
setMaxLinearSpeed
in interfacecom.badlogic.gdx.ai.steer.Limiter
-
getMaxLinearAcceleration
public float getMaxLinearAcceleration()
- Specified by:
getMaxLinearAcceleration
in interfacecom.badlogic.gdx.ai.steer.Limiter
-
setMaxLinearAcceleration
public void setMaxLinearAcceleration(float maxLinearAcceleration)
- Specified by:
setMaxLinearAcceleration
in interfacecom.badlogic.gdx.ai.steer.Limiter
-
getMaxAngularSpeed
public float getMaxAngularSpeed()
- Specified by:
getMaxAngularSpeed
in interfacecom.badlogic.gdx.ai.steer.Limiter
-
setMaxAngularSpeed
public void setMaxAngularSpeed(float maxAngularSpeed)
- Specified by:
setMaxAngularSpeed
in interfacecom.badlogic.gdx.ai.steer.Limiter
-
getMaxAngularAcceleration
public float getMaxAngularAcceleration()
- Specified by:
getMaxAngularAcceleration
in interfacecom.badlogic.gdx.ai.steer.Limiter
-
setMaxAngularAcceleration
public void setMaxAngularAcceleration(float maxAngularAcceleration)
- Specified by:
setMaxAngularAcceleration
in interfacecom.badlogic.gdx.ai.steer.Limiter
-
getPosition
public com.badlogic.gdx.math.Vector2 getPosition()
- Specified by:
getPosition
in interfacecom.badlogic.gdx.ai.utils.Location<com.badlogic.gdx.math.Vector2>
-
getOrientation
public float getOrientation()
- Specified by:
getOrientation
in interfacecom.badlogic.gdx.ai.utils.Location<com.badlogic.gdx.math.Vector2>
-
setOrientation
public void setOrientation(float orientation)
- Specified by:
setOrientation
in interfacecom.badlogic.gdx.ai.utils.Location<com.badlogic.gdx.math.Vector2>
-
vectorToAngle
public float vectorToAngle(com.badlogic.gdx.math.Vector2 vector)
- Specified by:
vectorToAngle
in interfacecom.badlogic.gdx.ai.utils.Location<com.badlogic.gdx.math.Vector2>
-
angleToVector
public com.badlogic.gdx.math.Vector2 angleToVector(com.badlogic.gdx.math.Vector2 outVector, float angle)
- Specified by:
angleToVector
in interfacecom.badlogic.gdx.ai.utils.Location<com.badlogic.gdx.math.Vector2>
-
newLocation
public com.badlogic.gdx.ai.utils.Location<com.badlogic.gdx.math.Vector2> newLocation()
- Specified by:
newLocation
in interfacecom.badlogic.gdx.ai.utils.Location<com.badlogic.gdx.math.Vector2>
-
-