Skip to main content

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

LCCObject::raycastFromOrigin

Custom origin and direction raycasting.

Supports custom origin and direction for raycasting against LCC model data in world space.

Version Requirement

SDK v0.3.0+

Engine Support

Three.js / CesiumJS

API

LCCObject::raycastFromOrigin(param: RaycastFromOriginParam): IPoint3 | null

Parameters

ParameterTypeRequiredDefaultDescription
param.origin{ x: number, y: number, z: number }Yes-Ray origin in world space coordinates.
param.direction{ x: number, y: number, z: number }Yes-Ray direction; can be normalized or unnormalized.
param.maxDistancenumberYes-Detection distance, in meters.
param.radiusnumberYes-Detection precision, 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

const origin = { x: 10, y: 10, z: 10 };
const startPos = { x: 10, y: 10, z: 10 };
const endPos = { x: 50, y: 50, z: 50 };
const direction = {
    x: endPos.x - startPos.x,
    y: endPos.y - startPos.y,
    z: endPos.z - startPos.z
};
const maxDistance = 100;
const radius = 0.01;

let checkPos = lccObject.raycastFromOrigin({ origin, direction, maxDistance, radius });
if (checkPos) {
    console.log('checkPos: ', 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.
  • direction can be a normalized or unnormalized vector.
  • If a radius value of 0.01 does not detect data, try increasing it, e.g., to 0.1.
  • LCCObject::raycast()
  • LCCObject::intersectsRayFromOriginExt()

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