Skip to main content

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

LCCObject::intersectsRayFromOriginExt

Collision-body-based raycasting with custom origin and direction.

Version Requirement

SDK v0.5.0+

Engine Support

Three.js

API

LCCObject::intersectsRayFromOriginExt(param: IntersectsRayFromOriginExtParam): IntersectsResult | null

Parameters

ParameterTypeRequiredDefaultDescription
param.origin{ x: number, y: number, z: number }Yes-Ray origin.
param.direction{ x: number, y: number, z: number }Yes-Ray direction.
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 ret = lccObject.hasCollision();
if (ret) {
    const origin = { x: 10, y: 10, z: 10 };
    const direction = { x: 1, y: 0, z: 0 };
    const maxDistance = 10;
    let result = lccObject.intersectsRayFromOriginExt({ origin, direction, maxDistance });
    if (result) {
        console.log('point: ', result.point.x, result.point.y, result.point.z);
        console.log('normal: ', result.normal.x, result.normal.y, result.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::intersectsRayExt()
  • LCCObject::raycastFromOrigin()

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