Skip to main content

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

LCCObject::intersectsRayExt

Collision-body-based raycasting that supports obtaining coordinate positions via screen clicks.

Version Requirement

SDK v0.5.0+

Engine Support

Three.js

API

LCCObject::intersectsRayExt(param: IntersectsRayExtParam): IntersectsResult | null

Parameters

ParameterTypeRequiredDefaultDescription
param.evtMouseEvent / PointerEventYes-Mouse click event.
param.maxDistancenumberYes-Detection distance, in meters.

Return Value

Returns an object containing point and normal on success; returns null on failure.

PropertyTypeDescription
point{ x: number, y: number, z: number }Collision point coordinates in world space.
normal{ x: number, y: number, z: number }Collision point normal in world space.

Usage Example

const cond = lccObject.hasCollision();
if (cond) {
    document.addEventListener('mousedown', (evt) => {
        let ret = lccObject.intersectsRayExt({ evt: evt, maxDistance: 10 });
        if (ret) {
            console.log('point: ', ret.point.x, ret.point.y, ret.point.z);
            console.log('normal: ', ret.normal.x, ret.normal.y, ret.normal.z);
        } else {
            // No point detected
        }
    });
} else {
    // Collision function not supported
}

Notes

  • This method must be called after the success callback of LCCRender.load() has been triggered.
  • Check collision support via hasCollision() before use.
  • The SDK only loads collision data within the vicinity of the camera position.
  • LCCObject::hasCollision()
  • LCCObject::intersectsRayFromOriginExt()
  • LCCObject::raycast()

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