OptionalcursorOptionalhitLimits pointer events to a shape inside the View, in View-local 2D space, with 3D picking still working inside it
hitArea replaces the bounds.Whether a point in the View's local 2D space is inside the View; pixi's hit test for the View
It answers true anywhere in the View's rectangle, so a click on empty space still reaches the
View, and "click empty space to deselect" needs no extra wiring. It also picks the 3D node
under the point for the event that follows.
Point in the View's local 2D space.
eventMode to 'none' or 'passive', which turn off 3D pointer events too.
'passive' lets 2D content through only while no 2D ancestor of the View is interactive.Casts a ray through a 2D point and returns the closest hit
position is in the space of event.global, as for View3D#screenToRay. Use it to pick
outside pointer events: placing decals, line of sight, drag-and-drop targets.
2D global point to cast through (e.g. event.global).
Optionalout: RaycastHit3D
Hit to write into, returned on a hit and untouched on a miss. Defaults to a new one for each hit.
The closest hit, or null on a miss or when the point falls outside the View's 2D rect.
null.out it allocates a new RaycastHit3D for each hit. Pass a hit from
createRaycastHit3D as out to pick every frame without garbage.// Drop a decal wherever the user taps.
view3d.on('pointertap', (e) => {
const hit = view3d.raycast(e.global);
if (hit) decal.position.copyFrom(hit.point); // world-space hit point
});
// Follow the pointer every frame, reusing one hit.
const hover = createRaycastHit3D();
app.ticker.add(() => {
if (view3d.raycast(pointer, hover)) cursor3d.position.copyFrom(hover.point);
});
View3D#screenToRay For the ray on its own, without a scene pick.
The pointer-event members of View3D
Pixi treats a View as one 2D object. When pixi hit-tests it, the View casts a ray into the scene and passes the event on to the 3D node it hits.
Example
See
EventBoundary3D For event settings that apply to the whole View, at
view3d.events.