Skip to main content

LCC for Web Manual · v0.6.3 · Page 30 of 68

LCCObject::raycast

Screen-click-based raycasting.

Can be used for annotation, measurement, ground detection (digital humans), and more.

Version Requirement

SDK v0.3.0+

Engine Support

Three.js / CesiumJS

API

LCCObject::raycast(param: RaycastParam): IPoint3 | null

Parameters

ParameterTypeRequiredDefaultDescription
param.evtMouseEvent / PointerEventYes-Mouse click event, e.g., mousedown.
param.maxDistancenumberYes-Maximum detection distance, in meters.
param.radiusnumberYes-Detection precision; adjust based on the actual scenario, in meters.
param.opacityThresholdnumberNo0.5Opacity threshold for high-precision detection, range [0, 1]. Only effective when usePrecisionRaycast is true. SDK v0.6.3+

Return Value

IPoint3 | null — Detected point coordinates (x, y, z) in world space. Returns null if no point is detected.

Usage Example

Three.js

document.addEventListener('mousedown', (evt) => {
    let checkPos = lccObject.raycast({ evt: evt, maxDistance: 100, radius: 0.1 });
    if (checkPos) {
        console.log(checkPos.x, checkPos.y, checkPos.z);
    } else {
        // No point detected
    }
});

CesiumJS

viewer.scene.canvas.addEventListener('pointerdown', (evt) => {
    let checkPos = lccObject.raycast({ evt: evt, maxDistance: 100, radius: 0.1 });
    if (checkPos) {
        console.log(checkPos.x, checkPos.y, checkPos.z);
    } else {
        // No point detected
    }
});

Notes

  • This method must be called after the success callback of LCCRender.load() has been triggered.
  • In Cesium, listen to the canvas pointerdown event, not document's mousedown.
  • The returned coordinates are in world space.
  • LCCObject::raycastFromOrigin()
  • LCCObject::intersectsRayExt()

XGRIDS documentation, reproduced as published and captured on October 27, 2026. Read this page on docs.xgrids.com

Stuck on a Step?

QRC supports every scanner and software seat it sells. Send us the page you are on and we will walk you through it.

Contact Us
Request a Quote