Skip to content
TREN
Atlıhan Harita

LCC for Web User Manual · API Reference

LCCObject::intersectsRayExt

Chapter 06.14 / 07Manual version v0.6.4English

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

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