C# Класс Nez.Collider

Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
collidesWithLayers int
isTrigger bool
physicsLayer int
shape Nez.PhysicsShapes.Shape
shouldColliderScaleAndRotateWithTransform bool

Защищенные свойства (Protected)

Свойство Тип Описание
_colliderRequiresAutoSizing bool
_isColliderRegistered bool
_isParentEntityAddedToScene bool
_localOffset Vector2

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

Метод Описание
clone ( ) : Component
collidesWith ( Collider collider, CollisionResult &result ) : bool

checks to see if this Collider collides with collider. If it does, true will be returned and result will be populated with collision data

collidesWith ( Collider collider, Vector2 motion, CollisionResult &result ) : bool

checks to see if this Collider with motion applied (delta movement vector) collides with collider. If it does, true will be returned and result will be populated with collision data.

collidesWithAny ( CollisionResult &result ) : bool

checks to see if this Collider collides with any other Colliders in the Scene. The first Collider it intersects will have its collision data returned in the CollisionResult.

collidesWithAny ( Vector2 &motion, CollisionResult &result ) : bool

checks to see if this Collider with motion applied (delta movement vector) collides with any collider. If it does, true will be returned and result will be populated with collision data. Motion will be set to the maximum distance the Collider can travel before colliding.

onAddedToEntity ( ) : void
onDisabled ( ) : void
onEnabled ( ) : void
onEntityTransformChanged ( Transform comp ) : void
onRemovedFromEntity ( ) : void
overlaps ( Collider other ) : bool

checks to see if this shape overlaps any other Colliders in the Physics system

registerColliderWithPhysicsSystem ( ) : void

the parent Entity will call this at various times (when added to a scene, enabled, etc)

setLocalOffset ( Vector2 offset ) : Collider

localOffset is added to entity.position to get the final position for the collider. This allows you to add multiple Colliders to an Entity and position them separately.

setShouldColliderScaleAndRotateWithTransform ( bool shouldColliderScaleAndRotateWithTransform ) : Collider

if set to true, the Collider will scale and rotate following the Transform it is attached to

unregisterColliderWithPhysicsSystem ( ) : void

the parent Entity will call this at various times (when removed from a scene, disabled, etc)

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

clone() публичный Метод

public clone ( ) : Component
Результат Component

collidesWith() публичный Метод

checks to see if this Collider collides with collider. If it does, true will be returned and result will be populated with collision data
public collidesWith ( Collider collider, CollisionResult &result ) : bool
collider Collider Collider.
result CollisionResult Result.
Результат bool

collidesWith() публичный Метод

checks to see if this Collider with motion applied (delta movement vector) collides with collider. If it does, true will be returned and result will be populated with collision data.
public collidesWith ( Collider collider, Vector2 motion, CollisionResult &result ) : bool
collider Collider Collider.
motion Vector2 Motion.
result CollisionResult Result.
Результат bool

collidesWithAny() публичный Метод

checks to see if this Collider collides with any other Colliders in the Scene. The first Collider it intersects will have its collision data returned in the CollisionResult.
public collidesWithAny ( CollisionResult &result ) : bool
result CollisionResult Result.
Результат bool

collidesWithAny() публичный Метод

checks to see if this Collider with motion applied (delta movement vector) collides with any collider. If it does, true will be returned and result will be populated with collision data. Motion will be set to the maximum distance the Collider can travel before colliding.
public collidesWithAny ( Vector2 &motion, CollisionResult &result ) : bool
motion Vector2 Motion.
result CollisionResult Result.
Результат bool

onAddedToEntity() публичный Метод

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

onDisabled() публичный Метод

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

onEnabled() публичный Метод

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

onEntityTransformChanged() публичный Метод

public onEntityTransformChanged ( Transform comp ) : void
comp Transform
Результат void

onRemovedFromEntity() публичный Метод

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

overlaps() публичный Метод

checks to see if this shape overlaps any other Colliders in the Physics system
public overlaps ( Collider other ) : bool
other Collider
Результат bool

registerColliderWithPhysicsSystem() публичный Метод

the parent Entity will call this at various times (when added to a scene, enabled, etc)
public registerColliderWithPhysicsSystem ( ) : void
Результат void

setLocalOffset() публичный Метод

localOffset is added to entity.position to get the final position for the collider. This allows you to add multiple Colliders to an Entity and position them separately.
public setLocalOffset ( Vector2 offset ) : Collider
offset Vector2 Offset.
Результат Collider

setShouldColliderScaleAndRotateWithTransform() публичный Метод

if set to true, the Collider will scale and rotate following the Transform it is attached to
public setShouldColliderScaleAndRotateWithTransform ( bool shouldColliderScaleAndRotateWithTransform ) : Collider
shouldColliderScaleAndRotateWithTransform bool If set to true should collider scale and rotate with transform.
Результат Collider

unregisterColliderWithPhysicsSystem() публичный Метод

the parent Entity will call this at various times (when removed from a scene, disabled, etc)
public unregisterColliderWithPhysicsSystem ( ) : void
Результат void

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

_colliderRequiresAutoSizing защищенное свойство

protected bool _colliderRequiresAutoSizing
Результат bool

_isColliderRegistered защищенное свойство

flag to keep track of if we registered ourself with the Physics system
protected bool _isColliderRegistered
Результат bool

_isParentEntityAddedToScene защищенное свойство

flag to keep track of if our Entity was added to a Scene
protected bool _isParentEntityAddedToScene
Результат bool

_localOffset защищенное свойство

protected Vector2 _localOffset
Результат Vector2

collidesWithLayers публичное свойство

layer mask of all the layers this Collider should collide with when Entity.move methods are used. defaults to all layers.
public int collidesWithLayers
Результат int

isTrigger публичное свойство

if this collider is a trigger it will not cause collisions but it will still trigger events
public bool isTrigger
Результат bool

physicsLayer публичное свойство

physicsLayer can be used as a filter when dealing with collisions. The Flags class has methods to assist with bitmasks.
public int physicsLayer
Результат int

shape публичное свойство

the underlying Shape of the Collider
public Shape,Nez.PhysicsShapes shape
Результат Nez.PhysicsShapes.Shape

shouldColliderScaleAndRotateWithTransform публичное свойство

if true, the Collider will scale and rotate following the Transform it is attached to
public bool shouldColliderScaleAndRotateWithTransform
Результат bool