Class Box2dLocation
java.lang.Object
com.devcharles.piazzapanic.utility.box2d.Box2dLocation
- All Implemented Interfaces:
com.badlogic.gdx.ai.utils.Location<com.badlogic.gdx.math.Vector2>
public class Box2dLocation
extends Object
implements com.badlogic.gdx.ai.utils.Location<com.badlogic.gdx.math.Vector2>
Vector2 wrapper that contains body orientation.-
Field Summary
FieldsModifier and TypeFieldDescription(package private) float(package private) com.badlogic.gdx.math.Vector2 -
Constructor Summary
ConstructorsConstructorDescriptionBox2dLocation(com.badlogic.gdx.math.Vector2 position, float orientation) Create a new location. -
Method Summary
Modifier and TypeMethodDescriptioncom.badlogic.gdx.math.Vector2angleToVector(com.badlogic.gdx.math.Vector2 outVector, float angle) Returns the unit vector in the direction of the specified angle expressed in radians.floatReturns the float value indicating the orientation of this location.com.badlogic.gdx.math.Vector2Returns the vector indicating the position of this location.com.badlogic.gdx.ai.utils.Location<com.badlogic.gdx.math.Vector2>Creates a new location.voidsetOrientation(float orientation) Sets the orientation of this location, i.e.floatvectorToAngle(com.badlogic.gdx.math.Vector2 vector) Returns the angle in radians pointing along the specified vector.
-
Field Details
-
position
com.badlogic.gdx.math.Vector2 position -
orientation
float orientation
-
-
Constructor Details
-
Box2dLocation
public Box2dLocation() -
Box2dLocation
public Box2dLocation(com.badlogic.gdx.math.Vector2 position, float orientation) Create a new location.- Parameters:
position-Worldposition vector.orientation- rotation in radians
-
-
Method Details
-
getPosition
public com.badlogic.gdx.math.Vector2 getPosition()Description copied from interface:com.badlogic.gdx.ai.utils.LocationReturns the vector indicating the position of this location.- Specified by:
getPositionin interfacecom.badlogic.gdx.ai.utils.Location<com.badlogic.gdx.math.Vector2>
-
getOrientation
public float getOrientation()Description copied from interface:com.badlogic.gdx.ai.utils.LocationReturns the float value indicating the orientation of this location. The orientation is the angle in radians representing the direction that this location is facing.- Specified by:
getOrientationin interfacecom.badlogic.gdx.ai.utils.Location<com.badlogic.gdx.math.Vector2>
-
setOrientation
public void setOrientation(float orientation) Description copied from interface:com.badlogic.gdx.ai.utils.LocationSets the orientation of this location, i.e. the angle in radians representing the direction that this location is facing.- Specified by:
setOrientationin interfacecom.badlogic.gdx.ai.utils.Location<com.badlogic.gdx.math.Vector2>- Parameters:
orientation- the orientation in radians
-
newLocation
public com.badlogic.gdx.ai.utils.Location<com.badlogic.gdx.math.Vector2> newLocation()Description copied from interface:com.badlogic.gdx.ai.utils.LocationCreates a new location.This method is used internally to instantiate locations of the correct type parameter
T. This technique keeps the API simple and makes the API easier to use with the GWT backend because avoids the use of reflection.- Specified by:
newLocationin interfacecom.badlogic.gdx.ai.utils.Location<com.badlogic.gdx.math.Vector2>- Returns:
- the newly created location.
-
vectorToAngle
public float vectorToAngle(com.badlogic.gdx.math.Vector2 vector) Description copied from interface:com.badlogic.gdx.ai.utils.LocationReturns the angle in radians pointing along the specified vector.- Specified by:
vectorToAnglein interfacecom.badlogic.gdx.ai.utils.Location<com.badlogic.gdx.math.Vector2>- Parameters:
vector- the vector
-
angleToVector
public com.badlogic.gdx.math.Vector2 angleToVector(com.badlogic.gdx.math.Vector2 outVector, float angle) Description copied from interface:com.badlogic.gdx.ai.utils.LocationReturns the unit vector in the direction of the specified angle expressed in radians.- Specified by:
angleToVectorin interfacecom.badlogic.gdx.ai.utils.Location<com.badlogic.gdx.math.Vector2>- Parameters:
outVector- the output vector.angle- the angle in radians.- Returns:
- the output vector for chaining.
-