Skip to content
TREN
Atlıhan Harita

LCC for Web User Manual · API Reference

LCCObject::intersectsCapsule

Chapter 06.13 / 07Manual version v0.6.4English

Capsule collision test.

Can be used to implement digital human collision features.

Version Requirement

SDK v0.4.1+

Engine Support

Three.js

API

LCCObject::intersectsCapsule(param: IntersectsCapsuleParam): IntersectsCapsuleResult

Parameters

ParameterTypeRequiredDefaultDescription
param.start{ x: number, y: number, z: number }Yes-Bottom point of the capsule.
param.end{ x: number, y: number, z: number }Yes-Top point of the capsule.
param.radiusnumberYes-Capsule radius.
param.noDeltabooleanNo-When true, collision offset is not calculated for faster detection; when false, offset is computed.

Return Value

PropertyTypeDescription
hitbooleanWhether a collision occurred.
delta{ x: number, y: number, z: number }Collision offset, useful for adjusting digital human position. Direction points toward the capsule. Only valid when noDelta is false.

Usage Example

const ret = lccObject.hasCollision();
if (ret) {
    const start = { x: 10, y: 10, z: 0 };
    const end = { x: 10, y: 10, z: 1.7 };
    const radius = 1;
    const noDelta = false;
    let intersectResult = lccObject.intersectsCapsule({ start, end, radius, noDelta });
    if (intersectResult.hit) {
        console.log('Collision occurs, delta: ', intersectResult.delta);
    }
} 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::intersectsSphere()

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