Skip to main content
Version: 4.0.0

Box Collider 2D

Colliders play a crucial role in creating interactive AR experiences by defining the physical boundaries and properties of objects within the scene. A Box Collider 2D is a collider component that defines a box-shaped volume around an object. It is particularly useful for representing objects with simple rectangular or square shapes.

For 3D objects, check out the Box Collider component.

Add a Box Collider 2D Component

To add a Box Collider 2D component:

  1. Go to the Hierarchy panel
  2. Add or select a 2D object and locate its components in the Inspector panel
  3. Click Add component
  4. Go to 2D Physics
  5. Select Box Collider 2D
add collider

Properties

properties
PropertyDescription
SizeThe dimensions of the box collider in local space. By specifying the size along the X, Y, and Z axes, you can precisely control the shape and dimensions of the collider.
OffsetDetermines the position of the center of the box collider in local space. By modifying the offset, you can change the position of the collider relative to the object it is attached to.
CategoryThe layer in the physical world
MaskLayers where collisions can occur
Physic MatterDefines the physical properties of a rigid body, such as its friction and bounciness
Is TangibleWhen unchecked, the collider will not physically affect other colliders, but will still generate trigger events when another collider enters or exits its bounds. When checked, the collider will physically interact with other colliders, blocking their movement and generating collisions. This property is checked by default.
Show ColliderWhen checked, this option allows the box collider to become visible in the scene view, making it easier to visualize and adjust its position and size during the editing process