Skip to main content

Box Collider

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 is a collider component that defines a box-shaped volume around an object. It is particularly useful for representing objects with simple rectangular or cubic shapes.

collider demos

Add a Collider Component

In the Hierarchy panel, select a 3D object and locate its components in the Inspector panel.

Click + Add component, go to 3D Physics, and then select your Box Collider.

add collider component

Properties

When working with a Box Collider, you can adjust the following properties.

add collider component
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.
OffsetThis determines 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.
RotationThe rotation of the box collider in local space
Physics MatterDefines the physical properties of a rigid body, such as its friction and bounciness.
Is TangibleDetermines whether the collider is a trigger or a solid collider. If true, the collider will not physically affect other colliders, but will still generate trigger events when another collider enters or exits its bounds. If false, the collider will physically interact with other colliders, blocking their movement and generating collisions. Defaults to true.
Show ColliderEnabling 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.
Fit MeshAutomatically sets the size of the box collider based on the mesh renderer attached to the same object. Useful for quickly creating a collider that accurately fits the mesh it is colliding with.

Use Colliders with a Rigid Body Component

In the physical world, objects require both colliders and rigid bodies to interact with one another realistically. Colliders define the shape and boundaries of objects, while rigid bodies provide the mass, velocity, and other physical properties necessary for realistic physics simulations.

By attaching a Collider component to a game object, you define its physical shape and characteristics. When a Rigid Body component is added to the same object, it enables the object to respond to physical forces like gravity, collisions, and interactions with other objects in the scene.

The combination of Collider and Rigid Body components allows for the creation of dynamic and interactive AR experiences in TikTok Effect House. By defining the appropriate Collider and configuring Rigid Body properties such as mass, drag, and constraints, you can achieve realistic object behavior and interactions within the AR environment.