intersection

Studio

intersection

("intersection", (IntersectionEvent) => void): this;

Emitted every frame for each raycaster that the object is intersected by.

Returns

this

Handler Function

When the intersection event is fired, attached handler functions are called with a single argument, an IntersectionEvent.

Example

symbol.nodes.Plane.on("intersection", (e) => {
    // Runs when intersection occurs on the Plane node
    // The argument e contains useful info about this event:

    // Stores the distance from the raycaster to this object in the raycaster's coordinate system
    var raycasterDistance = e.distance;

    // Stores the raycaster colliding with this object
    var raycaster = e.raycaster;

    // Stores the localPosition of the collision point [x,y,z] in the object's local coordinate system
    var localPosition = e.localPosition;
});
Open in new window