Skip to content

Component Icon Trigger Zone Component

The Trigger Zone feature is designed to track objects passing through the light beam and to track when the beam is passing over them.

Trigger Zone Demo
The sphere turns green when passing through the beam

When attached to a Volumetric Light Beam, it will generate a 3D Mesh Collider or a 2D Polygon Collider (depending on the beam's Dimensions property). This Collider can be used to trigger other Colliders/RigidBodies to detect when they are inside the beam or not.

The colliders are only generated at runtime, meaning they won't be visible in the editor when not in playmode.

Inspector Trigger Zone


The Trigger Zone component must be attached to a Volumetric Light Beam. You can use this button at the bottom of the Volumetric Light Beam inspector.

Attach Trigger Zone to a light beam


Set Is Trigger

  • True: the Collider will be created as a convex trigger (it won't be physical). This is the most common and default behavior.
  • False: the Collider will be a regular collider (it will be physical). In case you want the beam to actually collide with objects...

Range Multiplier

Change the length of the Collider: used to make the Collider longer or shorter than the actual beam's Range Distance.

  • Default value is 1.0: the exact same length than the beam.
  • For example, set 2.0 to make the Collider 2x longer than the beam.

Compatibility with other features

Realtime changes

The TriggerZone collider cannot be changed in realtime.
With the Track Changes During Playtime feature enabled, if you animate a property which change the shape of the beam, the collider shape won't fit anymore.

Dynamic Occlusion (Raycasting)

With 2D beams, the generated 2D Polygon Collider will be updated each time the dynamic occlusion has changed. This means it will take account of the occluded shape. toto

With 3D beams, for performance reasons, the collider will not be changed in realtime if an occluder blocks the beam (when the Dynamic Occlusion (Raycasting) feature is enabled). This means an Object could be triggered when located behind an occluder.

However, we provide the following script function you could ask to know where a Collider is located compared to an occluder:


Here is an example of the kind of script you could attach to your Collider/Rigidbody to check if they pass through a beam:

public class CheckIfInsideBeam : MonoBehaviour
    bool m_IsInsideBeam = false;
    Collider m_Collider = null;

    void Start()
        m_Collider = GetComponent<Collider>();

    void FixedUpdate()
        m_IsInsideBeam = false;

    void OnTriggerStay(Collider trigger)
        var dynamicOcclusion = trigger.GetComponent<VLB.DynamicOcclusionRaycasting>();

        if (dynamicOcclusion)
            // This GameObject is inside the beam's TriggerZone.
            // Make sure it's not hidden by an occluder
            m_IsInsideBeam = !dynamicOcclusion.IsColliderHiddenByDynamicOccluder(m_Collider);
            m_IsInsideBeam = true;

    void Update()
        // Do whatever you want with the m_IsInsideBeam property here

Dynamic Occlusion (Depth Buffer)

The Dynamic Occlusion (Depth Buffer) feature computes the occlusion on the GPU, and so the Trigger Zone feature is not compatible with it.