Class Box2dSquareAABBProximity

java.lang.Object
com.devcharles.piazzapanic.utility.box2d.Box2dSquareAABBProximity
All Implemented Interfaces:
com.badlogic.gdx.ai.steer.Proximity<com.badlogic.gdx.math.Vector2>, com.badlogic.gdx.physics.box2d.QueryCallback
Direct Known Subclasses:
Box2dRadiusProximity

public class Box2dSquareAABBProximity extends Object implements com.badlogic.gdx.ai.steer.Proximity<com.badlogic.gdx.math.Vector2>, com.badlogic.gdx.physics.box2d.QueryCallback
A Box2dSquareAABBProximity is a Proximity that queries the world for all fixtures that potentially overlap the square AABB built around the circle having the specified detection radius and whose center is the owner position.
Author:
davebaol
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     

    Nested classes/interfaces inherited from interface com.badlogic.gdx.ai.steer.Proximity

    com.badlogic.gdx.ai.steer.Proximity.ProximityCallback<T extends com.badlogic.gdx.math.Vector<T>>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final Box2dSquareAABBProximity.AABB
     
    protected com.badlogic.gdx.ai.steer.Proximity.ProximityCallback<com.badlogic.gdx.math.Vector2>
     
    protected float
     
    private int
     
    protected com.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2>
     
    protected com.badlogic.gdx.physics.box2d.World
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Box2dSquareAABBProximity(com.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2> owner, com.badlogic.gdx.physics.box2d.World world, float detectionRadius)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
    accept(com.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2> steerable)
     
    int
    findNeighbors(com.badlogic.gdx.ai.steer.Proximity.ProximityCallback<com.badlogic.gdx.math.Vector2> behaviorCallback)
    Finds the agents that are within the immediate area of the owner.
    float
    Returns the detection radius that is half the side of the square AABB.
    com.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2>
    Returns the owner of this proximity.
    protected com.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2>
    getSteerable(com.badlogic.gdx.physics.box2d.Fixture fixture)
     
    com.badlogic.gdx.physics.box2d.World
    Returns the box2d world.
    protected void
     
    boolean
    reportFixture(com.badlogic.gdx.physics.box2d.Fixture fixture)
    Called for each fixture found in the query AABB.
    void
    setDetectionRadius(float detectionRadius)
    Sets the detection radius that is half the side of the square AABB.
    void
    setOwner(com.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2> owner)
    Sets the owner of this proximity.
    void
    setWorld(com.badlogic.gdx.physics.box2d.World world)
    Sets the box2d world.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • owner

      protected com.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2> owner
    • world

      protected com.badlogic.gdx.physics.box2d.World world
    • behaviorCallback

      protected com.badlogic.gdx.ai.steer.Proximity.ProximityCallback<com.badlogic.gdx.math.Vector2> behaviorCallback
    • detectionRadius

      protected float detectionRadius
    • neighborCount

      private int neighborCount
    • aabb

      private static final Box2dSquareAABBProximity.AABB aabb
  • Constructor Details

    • Box2dSquareAABBProximity

      public Box2dSquareAABBProximity(com.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2> owner, com.badlogic.gdx.physics.box2d.World world, float detectionRadius)
  • Method Details

    • getOwner

      public com.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2> getOwner()
      Description copied from interface: com.badlogic.gdx.ai.steer.Proximity
      Returns the owner of this proximity.
      Specified by:
      getOwner in interface com.badlogic.gdx.ai.steer.Proximity<com.badlogic.gdx.math.Vector2>
    • setOwner

      public void setOwner(com.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2> owner)
      Description copied from interface: com.badlogic.gdx.ai.steer.Proximity
      Sets the owner of this proximity.
      Specified by:
      setOwner in interface com.badlogic.gdx.ai.steer.Proximity<com.badlogic.gdx.math.Vector2>
    • getWorld

      public com.badlogic.gdx.physics.box2d.World getWorld()
      Returns the box2d world.
    • setWorld

      public void setWorld(com.badlogic.gdx.physics.box2d.World world)
      Sets the box2d world.
    • getDetectionRadius

      public float getDetectionRadius()
      Returns the detection radius that is half the side of the square AABB.
    • setDetectionRadius

      public void setDetectionRadius(float detectionRadius)
      Sets the detection radius that is half the side of the square AABB.
    • findNeighbors

      public int findNeighbors(com.badlogic.gdx.ai.steer.Proximity.ProximityCallback<com.badlogic.gdx.math.Vector2> behaviorCallback)
      Description copied from interface: com.badlogic.gdx.ai.steer.Proximity
      Finds the agents that are within the immediate area of the owner. Each of those agents is passed to the reportNeighbor method of the specified callback.
      Specified by:
      findNeighbors in interface com.badlogic.gdx.ai.steer.Proximity<com.badlogic.gdx.math.Vector2>
      Returns:
      the number of neighbors found.
    • prepareAABB

      protected void prepareAABB(Box2dSquareAABBProximity.AABB aabb)
    • getSteerable

      protected com.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2> getSteerable(com.badlogic.gdx.physics.box2d.Fixture fixture)
    • accept

      protected boolean accept(com.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2> steerable)
    • reportFixture

      public boolean reportFixture(com.badlogic.gdx.physics.box2d.Fixture fixture)
      Description copied from interface: com.badlogic.gdx.physics.box2d.QueryCallback
      Called for each fixture found in the query AABB.
      Specified by:
      reportFixture in interface com.badlogic.gdx.physics.box2d.QueryCallback
      Returns:
      false to terminate the query.