Skip to content

Intersection Events

Studio is being deprecated, please head over to the documentation page for Mattercraft, our most advanced 3D tool for the web, where you can find the most recent information and tutorials.

An intersection event is an event that is fired as a result of a Z.Raycaster node intersecting with a Z.Object node that both:

  1. includes the same tag value as the Raycaster node’s colliderTag value, and
  2. is within the colliderLimit of the Raycaster node.

There are six intersection events that are split between the Raycaster node itself, and the intersecting Z.Object node. They are as follows:

EventNodeDescription
intersectionenterZ.RaycasterWhen the Raycaster first intersects with an object.
intersectionsZ.RaycasterOnce a frame with data for every object currently intersected by the Raycaster.
intersectionleaveZ.RaycasterWhen the Raycaster is no longer intersecting with an object.
intersectionenterZ.ObjectWhen the object is first intersected by a Raycaster.
intersectionZ.ObjectOnce a frame for each Raycaster that the object is intersected by.
intersectionleaveZ.ObjectWhen the object is no longer being intersected by a Raycaster.

Both intersectionenter events, along with Z.Raycaster’s intersections, and Z.Object’s intersection pass an IntersectionEvent argument to attached handler functions, providing further information on the intersection.