Package com.fs.starfarer.api.util
Class CollisionGridUtil
java.lang.Object
com.fs.starfarer.api.util.CollisionGridUtil
- All Implemented Interfaces:
CollisionGridAPI
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCollisionGridUtil
(float minX, float maxX, float minY, float maxY, float cellSize) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the object to every bucket that the area overlaps.protected void
addToBucket
(int cellX, int cellY, Object object) getCheckIterator
(org.lwjgl.util.vector.Vector2f loc, float objWidth, float objHeight) Returns an iterator for all the objects in this grid that are in the specified area.protected void
removeFromBucket
(int cellX, int cellY, Object object) void
removeObject
(Object object, org.lwjgl.util.vector.Vector2f loc, float objWidth, float objHeight) Removes the object from every bucket that the area overlaps.
-
Field Details
-
cellSize
protected float cellSize -
buckets
-
width
protected int width -
height
protected int height -
leftOf
protected int leftOf -
rightOf
protected int rightOf -
below
protected int below -
above
protected int above
-
-
Constructor Details
-
CollisionGridUtil
public CollisionGridUtil(float minX, float maxX, float minY, float maxY, float cellSize)
-
-
Method Details
-
addObject
public void addObject(Object object, org.lwjgl.util.vector.Vector2f loc, float objWidth, float objHeight) Description copied from interface:CollisionGridAPI
Adds the object to every bucket that the area overlaps.- Specified by:
addObject
in interfaceCollisionGridAPI
-
removeObject
public void removeObject(Object object, org.lwjgl.util.vector.Vector2f loc, float objWidth, float objHeight) Description copied from interface:CollisionGridAPI
Removes the object from every bucket that the area overlaps.- Specified by:
removeObject
in interfaceCollisionGridAPI
-
addToBucket
-
removeFromBucket
-
getCheckIterator
public Iterator<Object> getCheckIterator(org.lwjgl.util.vector.Vector2f loc, float objWidth, float objHeight) Description copied from interface:CollisionGridAPI
Returns an iterator for all the objects in this grid that are in the specified area.- Specified by:
getCheckIterator
in interfaceCollisionGridAPI
- Returns:
-