Starsector API
Loading...
Searching...
No Matches
com.fs.starfarer.api.combat.CollisionGridAPI Interface Reference

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)
 

Detailed Description

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.

Author
Alex Mosolov

Copyright 2018 Fractal Softworks, LLC

Definition at line 22 of file CollisionGridAPI.java.

Member Function Documentation

◆ addObject()

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.

Parameters
object
loc
objWidth
objHeight

◆ getCheckIterator()

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.

Parameters
loc
checkWidth
checkHeight
Returns

◆ removeObject()

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.

Parameters
object
loc
objWidth
objHeight

The documentation for this interface was generated from the following file: