BoxCollider2D

class in UnityEngine

/

Inherits from:Collider2D

Switch to Manual

Description

Колайдер для 2D физики представляет собой выровненый по осям прямоугольник.

Variables

autoTilingDetermines whether the BoxCollider2D's shape is automatically updated based on a SpriteRenderer's tiling properties.
edgeRadiusControls the radius of all edges created by the collider.
sizeШирина и высота прямоугольника.

Inherited members

Variables

enabledВключенное Поведение обновляется, выключенное Поведение не обновляется.
isActiveAndEnabledHas the Behaviour had active and enabled called?
attachedRigidbodyThe Rigidbody2D attached to the Collider2D.
bouncinessGet the bounciness used by the collider.
boundsОграничивающая зона действия коллайдера в мировых координатах.
compositeGet the CompositeCollider2D that is available to be attached to the collider.
densityThe density of the collider used to calculate its mass (when auto mass is enabled).
frictionGet the friction used by the collider.
isTriggerЯвляется ли этот коллайдер триггером?
offsetThe local offset of the collider geometry.
shapeCountКоличество отдельных фигурных областей в коллайдере.
sharedMaterialThe PhysicsMaterial2D that is applied to this collider.
usedByCompositeSets whether the Collider will be used or not used by a CompositeCollider2D.
usedByEffectorWhether the collider is used by an attached effector or not.
gameObjectИгровой объект к которому прикреплён данный компонент. Компонент всегда прикреплён к игровому объекту.
tagТег данного игрового объекта.
transformThe Transform attached to this GameObject.

Public Functions

CastCasts the Collider shape into the Scene starting at the Collider position ignoring the Collider itself.
ClosestPointReturns a point on the perimeter of this Collider that is closest to the specified position.
CreateMeshCreates a planar Mesh that is identical to the area defined by the Collider2D geometry.
DistanceCalculates the minimum separation of this collider against another collider.
GetContactsRetrieves all contact points for this Collider.
GetShapeHashGenerates a simple hash value based upon the geometry of the Collider2D.
IsTouchingCheck whether this collider is touching the collider or not.
IsTouchingLayersChecks whether this collider is touching any colliders on the specified layerMask or not.
OverlapColliderGet a list of all colliders that overlap this collider.
OverlapPointПроверяет, пересекается ли коллайдер с точкой в пространстве.
RaycastCasts a ray into the Scene that starts at the Collider position and ignores the Collider itself.
BroadcastMessageВызывает метод названный methodName на каждом MonoBehaviour этого game object-а или любого из его потомков.
CompareTagПомечен ли данный игровой объект тегом tag?
GetComponentReturns the component of Type type if the GameObject has one attached, null if it doesn't. Will also return disabled components.
GetComponentInChildrenВозвращает компонент типа type в GameObject или некоторого его потомка через поиск в глубину.
GetComponentInParentВозвращает все компоненты типа type из GameObject'а или из любого его родителя.
GetComponentsВозвращает все компоненты типа type в GameObject.
GetComponentsInChildrenВозвращает все компоненты типа type в GameObject или любому из его потомков.
GetComponentsInParentВозвращает все компоненты типа type в GameObject или любому из его родителей.
SendMessageВызывает метод с названием methodName в каждом MonoBehaviour в этом игровом объекте.
SendMessageUpwardsВызывает метод с именем methodName в каждом MonoBehaviour в этом игровом объекте и в каждом предке поведения.
TryGetComponentGets the component of the specified type, if it exists.

Messages

OnCollisionEnter2DПередается когда входящий коллайдер контактирует с коллайдером данного объекта (только 2D физика).
OnCollisionExit2DПередается, когда коллайдер другого объекта перестает соприкасаться с коллайдером этого объекта (только 2D физика).
OnCollisionStay2DПередается каждый кадр, пока коллайдер другого объекта контактирует с коллайдером данного объекта (только 2D физика).
OnTriggerEnter2DПередается, когда другой обьект входит в триггер присоединенный к данному обьекту (только 2D физика).
OnTriggerExit2DПередается когда другой объект покидает триггер, присоединенный к данному объекту(только 2D физика).
OnTriggerStay2DПередается каждый кадр, пока другой объект находится в триггере, присоединенном к этому объекту (только 2D физика).