Function EventEmitter

The EventEmitter provider component allow child components to register as an event emitter. Event emitter objects are rendered offscreen every frame and tested for proximity to the pointer location (i.e. mouse cursor).

Each object is asigned an unique color, using an override material, and a small area is rendered around the pointer. The rendered framebuffer is returned from the GPU and processed on the CPU side to detect pointer events, such as pointer click, pointer enter, pointer exit and pointer move.

This allows for a more performant interaction model (than using raycasting) when there are a large number of objects that needs to be tested.

To add a component as an event emitter, use the useEventEmitter hook.

<EventEmitter>
{ children }
</EventEmitter>

When a component is added as an event emitter, the entire object graph is added by default. Objects may be excluded by assigning it the NOT_EMITTER layer.