Skip to content
TREN
Atlıhan Harita

LCC for Web User Manual · API Reference

LCCObject::intersectsRayFromOriginExt

Chapter 06.15 / 07Manual version v0.6.4English

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()

This chapter is from the official XGRIDS user manual. Official source (opens in a new tab) · Updated:

XGRIDS Türkiye

We're With You During Setup and in the Field

Atlıhan Harita provides training and technical support for device setup, firmware updates, software use, and field applications. Send us your question and our specialist will get back to you.

+90 216 546 0804