C# Класс Nez.Physics

Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
gravity Microsoft.Xna.Framework.Vector2
raycastsHitTriggers bool
raycastsStartInColliders bool
spatialHashCellSize int

Открытые методы

Метод Описание
addCollider ( Collider collider ) : void

adds the collider to the physics system

boxcastBroadphase ( RectangleF rect, int layerMask = allLayers ) : IEnumerable

returns all colliders with bounds that are intersected by collider.bounds. Note that this is a broadphase check so it only checks bounds and does not do individual Collider-to-Collider checks!

boxcastBroadphaseExcludingSelf ( Collider collider, RectangleF &rect, int layerMask = allLayers ) : IEnumerable

returns all colliders that are intersected by bounds excluding the passed-in collider (self). this method is useful if you want to create the swept bounds on your own for other queries

boxcastBroadphaseExcludingSelf ( Collider collider, float deltaX, float deltaY, int layerMask = allLayers ) : IEnumerable

returns all colliders that are intersected by collider.bounds expanded to incorporate deltaX/deltaY excluding the passed-in collider (self)

boxcastBroadphaseExcludingSelf ( Collider collider, int layerMask = allLayers ) : IEnumerable

returns all colliders with bounds that are intersected by collider.bounds excluding the passed-in collider (self)

clear ( ) : void

removes all colliders from the SpatialHash

getAllColliders ( ) : IEnumerable

gets all the Colliders managed by the SpatialHash

linecast ( Vector2 start, Vector2 end, int layerMask = allLayers ) : RaycastHit

casts a line from start to end and returns the first hit of a collider that matches layerMask

linecastAll ( Vector2 start, Vector2 end, RaycastHit hits, int layerMask = allLayers ) : int

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

overlapCircle ( Vector2 center, float radius, int layerMask = allLayers ) : Collider

check if any collider falls within a circular area. Returns the first Collider encountered.

overlapCircleAll ( Vector2 center, float radius, Collider results, int layerMask = allLayers ) : int

gets all the colliders that fall within the specified circle

overlapRectangle ( RectangleF rect, int layerMask = allLayers ) : Collider

check if any collider falls within a rectangular area

overlapRectangleAll ( RectangleF &rect, Collider results, int layerMask = allLayers ) : int

gets all the colliders that fall within the specified rect

removeCollider ( Collider collider ) : void

removes the collider from the physics system

reset ( ) : void
updateCollider ( Collider collider ) : void

updates the colliders position in the physics system. This essentially just removes then re-adds the Collider with its new bounds

Приватные методы

Метод Описание
debugDraw ( float secondsToDisplay ) : void

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

Описание методов

addCollider() публичный статический Метод

adds the collider to the physics system
public static addCollider ( Collider collider ) : void
collider Collider Collider.
Результат void

boxcastBroadphase() публичный статический Метод

returns all colliders with bounds that are intersected by collider.bounds. Note that this is a broadphase check so it only checks bounds and does not do individual Collider-to-Collider checks!
public static boxcastBroadphase ( RectangleF rect, int layerMask = allLayers ) : IEnumerable
rect RectangleF
layerMask int Layer mask.
Результат IEnumerable

boxcastBroadphaseExcludingSelf() публичный статический Метод

returns all colliders that are intersected by bounds excluding the passed-in collider (self). this method is useful if you want to create the swept bounds on your own for other queries
public static boxcastBroadphaseExcludingSelf ( Collider collider, RectangleF &rect, int layerMask = allLayers ) : IEnumerable
collider Collider Collider.
rect RectangleF
layerMask int
Результат IEnumerable

boxcastBroadphaseExcludingSelf() публичный статический Метод

returns all colliders that are intersected by collider.bounds expanded to incorporate deltaX/deltaY excluding the passed-in collider (self)
public static boxcastBroadphaseExcludingSelf ( Collider collider, float deltaX, float deltaY, int layerMask = allLayers ) : IEnumerable
collider Collider Collider.
deltaX float
deltaY float
layerMask int
Результат IEnumerable

boxcastBroadphaseExcludingSelf() публичный статический Метод

returns all colliders with bounds that are intersected by collider.bounds excluding the passed-in collider (self)
public static boxcastBroadphaseExcludingSelf ( Collider collider, int layerMask = allLayers ) : IEnumerable
collider Collider Collider.
layerMask int
Результат IEnumerable

clear() публичный статический Метод

removes all colliders from the SpatialHash
public static clear ( ) : void
Результат void

getAllColliders() публичный статический Метод

gets all the Colliders managed by the SpatialHash
public static getAllColliders ( ) : IEnumerable
Результат IEnumerable

linecast() публичный статический Метод

casts a line from start to end and returns the first hit of a collider that matches layerMask
public static linecast ( Vector2 start, Vector2 end, int layerMask = allLayers ) : RaycastHit
start Microsoft.Xna.Framework.Vector2 Start.
end Microsoft.Xna.Framework.Vector2 End.
layerMask int Layer mask.
Результат RaycastHit

linecastAll() публичный статический Метод

casts a line through the spatial hash and fills the hits array up with any colliders that the line hits
public static linecastAll ( Vector2 start, Vector2 end, RaycastHit hits, int layerMask = allLayers ) : int
start Microsoft.Xna.Framework.Vector2 Start.
end Microsoft.Xna.Framework.Vector2 End.
hits RaycastHit Hits.
layerMask int Layer mask.
Результат int

overlapCircle() публичный статический Метод

check if any collider falls within a circular area. Returns the first Collider encountered.
public static overlapCircle ( Vector2 center, float radius, int layerMask = allLayers ) : Collider
center Microsoft.Xna.Framework.Vector2 Center.
radius float Radius.
layerMask int Layer mask.
Результат Collider

overlapCircleAll() публичный статический Метод

gets all the colliders that fall within the specified circle
public static overlapCircleAll ( Vector2 center, float radius, Collider results, int layerMask = allLayers ) : int
center Microsoft.Xna.Framework.Vector2 Center.
radius float Radius.
results Collider Results.
layerMask int Layer mask.
Результат int

overlapRectangle() публичный статический Метод

check if any collider falls within a rectangular area
public static overlapRectangle ( RectangleF rect, int layerMask = allLayers ) : Collider
rect RectangleF Rect.
layerMask int Layer mask.
Результат Collider

overlapRectangleAll() публичный статический Метод

gets all the colliders that fall within the specified rect
public static overlapRectangleAll ( RectangleF &rect, Collider results, int layerMask = allLayers ) : int
rect RectangleF Rect.
results Collider Results.
layerMask int Layer mask.
Результат int

removeCollider() публичный статический Метод

removes the collider from the physics system
public static removeCollider ( Collider collider ) : void
collider Collider Collider.
Результат void

reset() публичный статический Метод

public static reset ( ) : void
Результат void

updateCollider() публичный статический Метод

updates the colliders position in the physics system. This essentially just removes then re-adds the Collider with its new bounds
public static updateCollider ( Collider collider ) : void
collider Collider Collider.
Результат void

Описание свойств

gravity публичное статическое свойство

convenience field for storing a gravity value globally
public static Vector2,Microsoft.Xna.Framework gravity
Результат Microsoft.Xna.Framework.Vector2

raycastsHitTriggers публичное статическое свойство

Do raycasts detect Colliders configured as triggers?
public static bool raycastsHitTriggers
Результат bool

raycastsStartInColliders публичное статическое свойство

Do ray/line casts that start inside a collider detect those colliders?
public static bool raycastsStartInColliders
Результат bool

spatialHashCellSize публичное статическое свойство

cell size used when reset is called and a new SpatialHash is created
public static int spatialHashCellSize
Результат int