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
Modifier and Type Method Description com.badlogic.gdx.math.Vector2angleToVector(com.badlogic.gdx.math.Vector2 outVector, float angle)floatgetAngularVelocity()floatgetBoundingRadius()com.badlogic.gdx.math.Vector2getLinearVelocity()floatgetMaxAngularAcceleration()floatgetMaxAngularSpeed()floatgetMaxLinearAcceleration()floatgetMaxLinearSpeed()floatgetOrientation()com.badlogic.gdx.math.Vector2getPosition()floatgetZeroLinearSpeedThreshold()booleanisTagged()com.badlogic.gdx.ai.utils.Location<com.badlogic.gdx.math.Vector2>newLocation()voidsetBehavior(com.badlogic.gdx.ai.steer.SteeringBehavior<com.badlogic.gdx.math.Vector2> behavior)voidsetMaxAngularAcceleration(float maxAngularAcceleration)voidsetMaxAngularSpeed(float maxAngularSpeed)voidsetMaxLinearAcceleration(float maxLinearAcceleration)voidsetMaxLinearSpeed(float maxLinearSpeed)voidsetOrientation(float orientation)voidsetTagged(boolean tagged)voidsetZeroLinearSpeedThreshold(float value)voidstop()Stops all motionvoidupdate()Called once per frame.floatvectorToAngle(com.badlogic.gdx.math.Vector2 vector)Methods inherited from class com.mygdx.game.Components.Component
awake, cleanUp, getParent, getType, render, setParent, setRequirements, startMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
AINavigation
public AINavigation()
-
-
Method Details
-
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:
getLinearVelocityin interfacecom.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2>
-
getAngularVelocity
public float getAngularVelocity()- Specified by:
getAngularVelocityin interfacecom.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2>
-
getBoundingRadius
public float getBoundingRadius()- Specified by:
getBoundingRadiusin interfacecom.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2>
-
isTagged
public boolean isTagged()- Specified by:
isTaggedin interfacecom.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2>
-
setTagged
public void setTagged(boolean tagged)- Specified by:
setTaggedin interfacecom.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2>
-
getZeroLinearSpeedThreshold
public float getZeroLinearSpeedThreshold()- Specified by:
getZeroLinearSpeedThresholdin interfacecom.badlogic.gdx.ai.steer.Limiter
-
setZeroLinearSpeedThreshold
public void setZeroLinearSpeedThreshold(float value)- Specified by:
setZeroLinearSpeedThresholdin interfacecom.badlogic.gdx.ai.steer.Limiter
-
getMaxLinearSpeed
public float getMaxLinearSpeed()- Specified by:
getMaxLinearSpeedin interfacecom.badlogic.gdx.ai.steer.Limiter
-
setMaxLinearSpeed
public void setMaxLinearSpeed(float maxLinearSpeed)- Specified by:
setMaxLinearSpeedin interfacecom.badlogic.gdx.ai.steer.Limiter
-
getMaxLinearAcceleration
public float getMaxLinearAcceleration()- Specified by:
getMaxLinearAccelerationin interfacecom.badlogic.gdx.ai.steer.Limiter
-
setMaxLinearAcceleration
public void setMaxLinearAcceleration(float maxLinearAcceleration)- Specified by:
setMaxLinearAccelerationin interfacecom.badlogic.gdx.ai.steer.Limiter
-
getMaxAngularSpeed
public float getMaxAngularSpeed()- Specified by:
getMaxAngularSpeedin interfacecom.badlogic.gdx.ai.steer.Limiter
-
setMaxAngularSpeed
public void setMaxAngularSpeed(float maxAngularSpeed)- Specified by:
setMaxAngularSpeedin interfacecom.badlogic.gdx.ai.steer.Limiter
-
getMaxAngularAcceleration
public float getMaxAngularAcceleration()- Specified by:
getMaxAngularAccelerationin interfacecom.badlogic.gdx.ai.steer.Limiter
-
setMaxAngularAcceleration
public void setMaxAngularAcceleration(float maxAngularAcceleration)- Specified by:
setMaxAngularAccelerationin interfacecom.badlogic.gdx.ai.steer.Limiter
-
getPosition
public com.badlogic.gdx.math.Vector2 getPosition()- Specified by:
getPositionin interfacecom.badlogic.gdx.ai.utils.Location<com.badlogic.gdx.math.Vector2>
-
getOrientation
public float getOrientation()- Specified by:
getOrientationin interfacecom.badlogic.gdx.ai.utils.Location<com.badlogic.gdx.math.Vector2>
-
setOrientation
public void setOrientation(float orientation)- Specified by:
setOrientationin interfacecom.badlogic.gdx.ai.utils.Location<com.badlogic.gdx.math.Vector2>
-
vectorToAngle
public float vectorToAngle(com.badlogic.gdx.math.Vector2 vector)- Specified by:
vectorToAnglein 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:
angleToVectorin 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:
newLocationin interfacecom.badlogic.gdx.ai.utils.Location<com.badlogic.gdx.math.Vector2>
-