C# Class Nez.Spatial.SpatialHash

Afficher le fichier Open project: prime31/Nez Class Usage Examples

Méthodes publiques

Свойство Type Description
gridBounds Microsoft.Xna.Framework.Rectangle

Méthodes publiques

Méthode Description
SpatialHash ( int cellSize = 100 ) : System
aabbBroadphase ( RectangleF &bounds, Collider excludeCollider, int layerMask ) : HashSet

returns all objects in cells that the bounding box intersects

clear ( ) : void
debugDraw ( float secondsToDisplay, float textScale = 1f ) : void

debug draws the contents of the spatial hash. Note that Core.debugRenderEnabled must be true or nothing will be displayed.

debugDrawCellDetails ( int x, int y, int cellCount, float secondsToDisplay = 0.5f, float textScale = 1f ) : void
getAllObjects ( ) : HashSet

returns all the Colliders in the SpatialHash

linecast ( Vector2 start, Vector2 end, RaycastHit hits, int layerMask ) : int

casts a line through the spatial hash and fills the hits array up with any colliders that the line hits

overlapCircle ( Vector2 circleCenter, float radius, Collider results, int layerMask ) : int

gets all the colliders that fall within the specified circle

overlapRectangle ( RectangleF &rect, Collider results, int layerMask ) : int

gets all the colliders that fall within the specified rect

register ( Collider collider ) : void

adds the object to the SpatialHash

remove ( Collider collider ) : void

removes the object from the SpatialHash

removeWithBruteForce ( Collider obj ) : void

removes the object from the SpatialHash using a brute force approach

Private Methods

Méthode Description
cellAtPosition ( int x, int y, bool createCellIfEmpty = false ) : List
cellCoords ( float x, float y ) : Point
cellCoords ( int x, int y ) : Point

Method Details

SpatialHash() public méthode

public SpatialHash ( int cellSize = 100 ) : System
cellSize int
Résultat System

aabbBroadphase() public méthode

returns all objects in cells that the bounding box intersects
public aabbBroadphase ( RectangleF &bounds, Collider excludeCollider, int layerMask ) : HashSet
bounds RectangleF Bounds.
excludeCollider Collider
layerMask int Layer mask.
Résultat HashSet

clear() public méthode

public clear ( ) : void
Résultat void

debugDraw() public méthode

debug draws the contents of the spatial hash. Note that Core.debugRenderEnabled must be true or nothing will be displayed.
public debugDraw ( float secondsToDisplay, float textScale = 1f ) : void
secondsToDisplay float Seconds to display.
textScale float Text scale.
Résultat void

debugDrawCellDetails() public méthode

public debugDrawCellDetails ( int x, int y, int cellCount, float secondsToDisplay = 0.5f, float textScale = 1f ) : void
x int
y int
cellCount int
secondsToDisplay float
textScale float
Résultat void

getAllObjects() public méthode

returns all the Colliders in the SpatialHash
public getAllObjects ( ) : HashSet
Résultat HashSet

linecast() public méthode

casts a line through the spatial hash and fills the hits array up with any colliders that the line hits
public linecast ( Vector2 start, Vector2 end, RaycastHit hits, int layerMask ) : int
start Vector2 Start.
end Vector2 End.
hits RaycastHit Hits.
layerMask int Layer mask.
Résultat int

overlapCircle() public méthode

gets all the colliders that fall within the specified circle
public overlapCircle ( Vector2 circleCenter, float radius, Collider results, int layerMask ) : int
circleCenter Vector2 Circle center.
radius float Radius.
results Collider Results.
layerMask int Layer mask.
Résultat int

overlapRectangle() public méthode

gets all the colliders that fall within the specified rect
public overlapRectangle ( RectangleF &rect, Collider results, int layerMask ) : int
rect RectangleF Rect.
results Collider Results.
layerMask int Layer mask.
Résultat int

register() public méthode

adds the object to the SpatialHash
public register ( Collider collider ) : void
collider Collider Object.
Résultat void

remove() public méthode

removes the object from the SpatialHash
public remove ( Collider collider ) : void
collider Collider Collider.
Résultat void

removeWithBruteForce() public méthode

removes the object from the SpatialHash using a brute force approach
public removeWithBruteForce ( Collider obj ) : void
obj Collider Object.
Résultat void

Property Details

gridBounds public_oe property

public Rectangle,Microsoft.Xna.Framework gridBounds
Résultat Microsoft.Xna.Framework.Rectangle