|
Starsector API
|
Public Member Functions | |
| void | addObject (Object object, Vector2f loc, float objWidth, float objHeight) |
| void | removeObject (Object object, Vector2f loc, float objWidth, float objHeight) |
| Iterator< Object > | getCheckIterator (Vector2f loc, float checkWidth, float checkHeight) |
Bin-lattice with combat entities - ships, missiles, asteroids, projectiles, beams, etc - sorted into buckets based on their location. May only have a subset of these objects in it, depending on this grid's role.
Used to fulfill "all objects in area" queries without having to iterate through every object.
Occasionally just getting a list of the entities - i.e. via CombatEngineAPI.getShips() may be a bit faster than using the grid. In particular, this will more often be the case when using the grid for a large area. For something very performance intensive, it makes sense to try each way to see which is faster in a given situation.
Copyright 2018 Fractal Softworks, LLC
Definition at line 22 of file CollisionGridAPI.java.
| void com.fs.starfarer.api.combat.CollisionGridAPI.addObject | ( | Object | object, |
| Vector2f | loc, | ||
| float | objWidth, | ||
| float | objHeight ) |
Adds the object to every bucket that the area overlaps.
| object | |
| loc | |
| objWidth | |
| objHeight |
Implemented in com.fs.starfarer.api.util.CollisionGridUtil.
| Iterator< Object > com.fs.starfarer.api.combat.CollisionGridAPI.getCheckIterator | ( | Vector2f | loc, |
| float | checkWidth, | ||
| float | checkHeight ) |
Returns an iterator for all the objects in this grid that are in the specified area.
| loc | |
| checkWidth | |
| checkHeight |
Implemented in com.fs.starfarer.api.util.CollisionGridUtil.
| void com.fs.starfarer.api.combat.CollisionGridAPI.removeObject | ( | Object | object, |
| Vector2f | loc, | ||
| float | objWidth, | ||
| float | objHeight ) |
Removes the object from every bucket that the area overlaps.
| object | |
| loc | |
| objWidth | |
| objHeight |
Implemented in com.fs.starfarer.api.util.CollisionGridUtil.