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

    Fields
    Modifier and Type
    Field
    Description
    (package private) float
     
    (package private) com.badlogic.gdx.math.Vector2
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    Box2dLocation(com.badlogic.gdx.math.Vector2 position, float orientation)
    Create a new location.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.badlogic.gdx.math.Vector2
    angleToVector(com.badlogic.gdx.math.Vector2 outVector, float angle)
    Returns the unit vector in the direction of the specified angle expressed in radians.
    float
    Returns the float value indicating the orientation of this location.
    com.badlogic.gdx.math.Vector2
    Returns the vector indicating the position of this location.
    com.badlogic.gdx.ai.utils.Location<com.badlogic.gdx.math.Vector2>
    Creates a new location.
    void
    setOrientation(float orientation)
    Sets the orientation of this location, i.e.
    float
    vectorToAngle(com.badlogic.gdx.math.Vector2 vector)
    Returns the angle in radians pointing along the specified vector.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 - World position vector.
      orientation - rotation in radians
  • Method Details

    • getPosition

      public com.badlogic.gdx.math.Vector2 getPosition()
      Description copied from interface: com.badlogic.gdx.ai.utils.Location
      Returns the vector indicating the position of this location.
      Specified by:
      getPosition in interface com.badlogic.gdx.ai.utils.Location<com.badlogic.gdx.math.Vector2>
    • getOrientation

      public float getOrientation()
      Description copied from interface: com.badlogic.gdx.ai.utils.Location
      Returns 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:
      getOrientation in interface com.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.Location
      Sets the orientation of this location, i.e. the angle in radians representing the direction that this location is facing.
      Specified by:
      setOrientation in interface com.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.Location
      Creates 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:
      newLocation in interface com.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.Location
      Returns the angle in radians pointing along the specified vector.
      Specified by:
      vectorToAngle in interface com.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.Location
      Returns the unit vector in the direction of the specified angle expressed in radians.
      Specified by:
      angleToVector in interface com.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.