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 ClassesNested 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
FieldsModifier and TypeFieldDescriptionprivate static final Box2dSquareAABBProximity.AABBprotected com.badlogic.gdx.ai.steer.Proximity.ProximityCallback<com.badlogic.gdx.math.Vector2>protected floatprivate intprotected com.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2>protected com.badlogic.gdx.physics.box2d.World -
Constructor Summary
ConstructorsConstructorDescriptionBox2dSquareAABBProximity(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 TypeMethodDescriptionprotected booleanaccept(com.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2> steerable) intfindNeighbors(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.floatReturns the detection radius that is half the side of the square AABB.com.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2>getOwner()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.WorldgetWorld()Returns the box2d world.protected voidbooleanreportFixture(com.badlogic.gdx.physics.box2d.Fixture fixture) Called for each fixture found in the query AABB.voidsetDetectionRadius(float detectionRadius) Sets the detection radius that is half the side of the square AABB.voidsetOwner(com.badlogic.gdx.ai.steer.Steerable<com.badlogic.gdx.math.Vector2> owner) Sets the owner of this proximity.voidsetWorld(com.badlogic.gdx.physics.box2d.World world) Sets the box2d world.
-
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
-
-
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.ProximityReturns the owner of this proximity.- Specified by:
getOwnerin interfacecom.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.ProximitySets the owner of this proximity.- Specified by:
setOwnerin interfacecom.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.ProximityFinds the agents that are within the immediate area of the owner. Each of those agents is passed to thereportNeighbormethod of the specified callback.- Specified by:
findNeighborsin interfacecom.badlogic.gdx.ai.steer.Proximity<com.badlogic.gdx.math.Vector2>- Returns:
- the number of neighbors found.
-
prepareAABB
-
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.QueryCallbackCalled for each fixture found in the query AABB.- Specified by:
reportFixturein interfacecom.badlogic.gdx.physics.box2d.QueryCallback- Returns:
- false to terminate the query.
-