XGRIDSDocs
  • 简体中文
  • English
  • 繁體中文
  • 日本語
  • Deutsch
  • Español
  • Italiano
  • Français
  • Русский
  • Polski
  • Nederlands
  • 简体中文
  • English
  • 繁體中文
  • 日本語
  • Deutsch
  • Español
  • Italiano
  • Français
  • Русский
  • Polski
  • Nederlands
  • Lixel PortalCam Series

    • PortalCam P1

      • Product Overview
      • Basic Operation
      • Using the LCC Scan App
      • Maintenance and Care
      • FAQ
  • Lixel K Series

    • Lixel K1

      • Product Overview
      • Basic Operation
      • Device Activation and Connection
      • Scanning Workflow
      • Acquire Point Cloud Data with Absolute Coordinate
      • Map Fusion
      • Route Planning Suggestions for Typical Scenes
      • Precautions
      • FAQ
    • Lixel K2

      • Product Overview
      • Basic Operation
      • Device Activation and Connection
      • Scanning Workflow
      • Acquire Point Cloud Data with Absolute Coordinate
      • Map Fusion
      • Route Planning Suggestions for Typical Scenes
      • Precautions
      • FAQ
  • Lixel L Series

    • Lixel L2 Pro

      • Product Overview
      • Basic Operation
      • Device Activation and Connection
      • Scanning Workflow
      • Acquire Point Cloud Data with Absolute Coordinate
      • Measure Point
      • Appendix
      • FAQ
    • Lixel L3

      • Product Overview
      • Basic Device Functions
      • Device Activation and Connection
      • Data Capture
      • Capturing Absolute Coordinates
      • Appendix
  • Accessories

    • Stick Light

      • Installation Guide
      • Basic Operation
      • FAQ
  • Lixel Studio

    • Version and Copyright
    • Installation and Activation
    • Software Interface
    • File Operations
    • Project Processing
    • Tools
    • 2D Drawing
    • Applications
    • Settings
    • Device Connection
    • FAQ
  • Lixel CyberColor

    • LCC Studio

      • Getting Started
      • Version and Updates
      • Download and Installation
      • Interface Overview and Navigation
      • Before Reconstruction
      • Model Reconstruction
      • Single Model Reconstruction
      • Map Fusion
      • Aerial-Ground Fusion
      • Aerial Reconstruction
      • My Models
      • Other Features
      • Settings and Account
      • Converter
      • Video Reconstruction
      • FAQ
    • LCC Scene Editor

      • Version & Updates
      • Account & Login
      • Product Overview & Home
      • Editor Interface
      • Scene Navigation Modes
      • File
      • Settings
      • Edit Operations
      • Window
      • Global Toolbar
      • Assets & Properties
      • Left Toolbar
      • Viewpoints
      • Portal
      • Skybox
      • Annotations
      • Measurement
      • Flythrough
      • Scene Report
      • 3D Layout
      • Mini-Map
      • Preview Mode (Viewer)
      • Help
      • FAQ
      • Spawn Point
    • LCC Model Editor

      • Version and Updates
      • User Guide
      • Overview and Interface
      • File Operations
      • Selectors
      • Editing Models
      • Measurement
      • Color Grading
      • Asset Management
      • Settings and Help
      • FAQ
    • Capture Guide

      • Overview
      • Capture Devices Overview
      • General Capture Principles
      • Indoor Scene Capture
      • Outdoor Scene Capture
      • Large-Scale Capture (Map Fusion)
      • Aerial-Ground Map Fusion Capture
      • Object Capture
      • People Capture
      • Video Reconstruction Capture
      • HD Enhancement
      • Control Points (Lixel P1)
      • FAQ and Troubleshooting
    • LCC Studio Linux

      • Product Overview
      • Architecture Guide
      • Installation and Deployment Guide
      • Container Startup Parameters Guide
      • CodeMeter Offline Licensing Deployment Guide
      • API Reference
      • Appendix - Developer Data Guide
      • Appendix - Error Code List
      • Single-Machine Multi-GPU Cluster Deployment QuickStart
    • Best Practices

      • Merging Multiple Large 3DGS Models
    • Version History
  • Plugin & SDK

    • Unreal

      • Introduction
      • Quick Start - Windows
      • Quick Start - Linux
      • Quick Start - Quest3
      • Editions and Licensing
      • Rendering
      • Tiled Rasterization (Experimental)
      • Visual Settings
      • Normals and Lighting
      • Scene Editing
      • Performance Parameters
      • Performance Guide
      • Third-party and Engine Plugin Integration
      • Proxy Mesh
      • Loading Animation
      • Collision
      • Navigation System Support
      • Single Layer Water Support
      • Localization
      • FAQ
      • Troubleshooting
      • Logging and Diagnostics
      • Contact Us
      • Best Practices

        • Relighting 3DGS with a LixelStudio Mesh
      • API Reference

        • ALCCActorBase
        • ULCCComponentBase
        • ULCCComponent
        • ULCC2Component
        • SOG / SPZ / PLY Actors
        • ALCC2ProxyMesh
        • ALCCClippingVolume
        • ALCCSectionPlane
        • ALCCLoadVolume
        • ULCCUtilLibrary
        • Enums
        • Structs
      • Changelog

        • v3.4.0
        • v3.3.1
        • v3.0.0
        • v2.2.1
        • v1.0.0
        • v0.9.0
        • v0.8.0
        • v0.7.1
        • v0.6.1
        • v0.5.2
        • v0.4.1
        • v0.4.0
        • v0.3.0
        • v0.0.5
        • v0.0.4
        • v0.0.3
        • v0.0.2
        • v0.0.1
    • Unity

      • Unity SDK Introduction
      • Technical Features
      • Development Environment Requirements
      • PC Quick Start Guide
      • Project Settings Optimization Guide
      • Pico 4 Ultra Development Guide
      • Pico 4 Ultra PC Streaming Guide
      • Quest 3 Development Guide
      • Quest 3 PC Streaming Guide
      • OpenXR Development Guide
      • Pico 4 Ultra Business Streaming Guide
      • Glossary
      • FAQ
      • Contact Us
      • Feature Development Guide

        • Multi-Scene Mixed Rendering Development Guide
        • Shadow Receiving Development Guide
        • Real-Time Lighting Development Guide
        • Multi-Camera Rendering Development Guide
        • High-Resolution Image Rendering Development Guide
        • LCC and LCC2 Data Format Compatibility Development Guide
        • Loading Effect Development Guide
        • Mip Rendering Mode Switching Development Guide
        • Edge and Corner Snapping Development Guide
        • Projected Decal Development Guide
        • Video Projected Decal Development Guide
        • Highlight Development Guide
        • Real-Time Clipping Development Guide
        • Color Adjustment Development Guide
        • Getting Scene Mesh Data Development Guide
        • Editor Mode Development Guide
        • Render Performance Parameter Configuration Guide
        • Application and Data Co-packaging Development Guide
        • Collision System Development Guide
        • macOS Development Permission Issue Guide
        • iOS Device Compilation and Packaging Development Guide
      • API Reference

        • LCCManager
        • Renderer
        • Data Types
      • Changelog

        • v2.3.0
        • v2.2.10
        • v2.2.0
        • v2.1.19
        • v2.0.14
    • Web

      • Introduction
      • Rendering Performance Optimization Guide
      • Graphics Configuration
      • FAQ
      • API Reference

        • LCCRender::clearIndexDB
        • LCCRender::dispose
        • LCCRender::load
        • LCCRender::setCamera
        • LCCRender::unload
        • LCCRender::update
        • LCCObject::checkRenderNextFrame
        • LCCObject::clearRenderNextFrame
        • LCCObject::ecef2Prj
        • LCCObject::getBounds
        • LCCObject::getEnvInstancedMesh
        • LCCObject::getInstancedMesh
        • LCCObject::getLodInfos
        • LCCObject::getOriginPosition
        • LCCObject::getProjectionCoordinateSystemInfos
        • LCCObject::hasCollision
        • LCCObject::hasEnvironment
        • LCCObject::hasShcoef
        • LCCObject::intersectsCapsule
        • LCCObject::intersectsRayExt
        • LCCObject::intersectsRayFromOriginExt
        • LCCObject::intersectsSphere
        • LCCObject::lowerToBottom
        • LCCObject::prj2Ecef
        • LCCObject::raiseToTop
        • LCCObject::raycast
        • LCCObject::raycastFromOrigin
        • LCCObject::setAlpha
        • LCCObject::setClipBox
        • LCCObject::setClipPlane
        • LCCObject::setEndLod
        • LCCObject::setLodAutoLevelUp
        • LCCObject::setMaxDistance
        • LCCObject::setMaxNodeSplats
        • LCCObject::setMaxSplats
        • LCCObject::setOriginPosition
        • LCCObject::setPointsColor
        • LCCObject::setRenderState
        • LCCObject::setRotation
        • LCCObject::setScale
        • LCCObject::setSemantic
        • LCCObject::setSemanticColor
        • LCCObject::setSmooth
        • LCCObject::setStartLod
        • LCCObject::setTranslation
        • LCCObject::setVisible
        • LCCObject::togglePointsDisplayMode
        • LCCObject::useEnvironment
        • LCCObject::useShcoef
      • Changelog

        • v0.6.3
        • v0.6.2
        • v0.6.1
        • v0.6.0
        • v0.5.5
        • v0.5.4
        • v0.5.3
        • v0.5.2
        • v0.5.1
        • v0.5.0
        • v0.4.1
        • v0.4.0
        • v0.3.1
        • v0.3.0
        • v0.2.0
    • Lixel OpenAPI

      • Overview
      • Connection & Authentication
      • Message Model & Codec
      • Interface Catalog
      • Real-time Data
      • Project File Access
      • Error Codes
      • Python

        • Quick Start
        • Client Wrapper & Tools
        • FAQ
      • C++

        • Quick Start
        • Client & Examples
        • FAQ

Collision System Development Guide

LCC Unity SDK has a built-in collision system, focused on solving the acceleration of collider construction and collision detection — that is, the collision performance problem. Unity's Collider system cannot handle real-time detection in very large scenes.

LCC Unity SDK uses its own built-in collision system, no longer relying on Unity's MeshCollider component and related capabilities, so it cannot directly act on GameObjects in a Unity scene. The official LCC data format generated by XGrids (LCC Studio) generates Mesh data used for collision during reconstruction at the same time, and the SDK uses this collision data to quickly and efficiently build scene collision. Because it is a self-built collision system, using the collision feature requires calling the corresponding methods provided by the SDK.

Note:

The SDK's built-in collision system is incompatible with Unity's Collider system and cannot directly act on Rigidbody objects in Unity. Collision for characters such as digital humans needs to be driven by the SDK's detection methods (see "Digital Human Collision Implementation" below).

For fixed scenes, you can also extract the Mesh data and bake it into a NavMesh in advance, which can be compatible with Unity's Collider system; see the NavMesh guide for details.

Data Prerequisites

The prerequisite for collision detection to work is that the scene has corresponding collision data. Data reconstructed in earlier versions may not contain collision data; in that case, calling SetColliderEnable(true) returns false, and all subsequent detection methods are unavailable.

Therefore, after enabling collision, be sure to check the return value:

bool ok = renderer.SetColliderEnable(true);
if (!ok)
{
    Debug.LogWarning("The current data contains no collider, cannot enable collision detection");
}

Basic Usage Workflow

The basic workflow for the collision feature has three steps:

  1. Load the scene data through the Load() method.
  2. In the load-complete callback, enable collision through SetColliderEnable(true).
  3. Perform collision detection through the various detection methods (RaycastMesh / IntersectsSphere / IntersectsCapsule).
// 1. Load the scene
renderer.Load(dataPath, onProgress: null, onComplete: () =>
{
    // 2. Enable collision after loading completes
    if (renderer.SetColliderEnable(true))
    {
        colliderReady = true;
    }
});

void Update()
{
    if (!colliderReady) return;

    // 3. Perform collision detection every frame
    var capsule = new Capsule(footPos, headPos, 0.3f);
    if (m_manager.IntersectsCapsule(capsule, out Vector3 delta))
    {
        characterController.Move(delta);
    }
}

Note:

SetColliderEnable() is a method of Renderer, while the detection methods (RaycastMesh / IntersectsSphere / IntersectsCapsule / Raycast) are on LCCManager. Call them on the corresponding objects respectively.

Basic collision system workflow: load scene → enable collision → collision detection

Basic collision system workflow

Digital Human Collision Implementation

Because the SDK's collision system does not act on Unity's Rigidbody, collision for digital humans (characters) needs to be driven by the detection methods. There are three common approaches:

  • Dual-ray detection: use RaycastMesh() to fire one ray downward and one forward, and judge whether the character can walk based on the ray return results (probe the ground downward, probe obstacles forward).
  • Capsule detection: use IntersectsCapsule() to detect whether the capsule the digital human is in intersects the collision mesh, and judge whether it can walk. The overloaded version's _delta returns the offset of the next safely reachable point.
  • Sphere detection: use IntersectsSphere() to detect whether the sphere the digital human is in intersects the collision mesh, and judge whether it can walk. The overloaded version's _delta also returns the offset of a safely reachable point.
Three implementation approaches for digital human collision: dual-ray, capsule, and sphere detection

Three implementation approaches for digital human collision

Choosing Between RaycastMesh and Raycast

The SDK provides two types of ray detection methods with different purposes:

MethodDetection targetPrecisionSpeedApplicable scenario
RaycastMesh()Collision mesh (Collider data)Relatively lowFastDigital human collision, per-frame detection
Raycast()Gaussian primitives (does not rely on the collision mesh)Relatively highSlowMeasurement-type applications

Raycast() performs ray detection directly on Gaussian primitives, with higher precision but slower speed, and is not recommended for per-frame calls, so it is not suitable for digital human collision, only for measurement-type use. For digital human collision, prefer RaycastMesh(), which relies on the collision mesh.

Related APIs

Among the collision-related methods below, SetColliderEnable() is on Renderer, while the remaining detection methods are on LCCManager. All detection methods are only available after the scene finishes loading and SetColliderEnable(true) has been called successfully.

SetColliderEnable

// Return value: bool → true=set successfully, false=data contains no collider or instance is not active
public bool SetColliderEnable(bool _enable)

Toggles the collider feature. After enabling, IntersectsSphere / IntersectsCapsule / RaycastMesh become available.

ParameterTypeDescription
_enableboolWhether to enable the collider

Usage example:

bool ok = renderer.SetColliderEnable(true);
if (!ok) Debug.LogWarning("Data contains no collider");

Description:

  • The data must contain collision (Mesh) data, otherwise it returns false.
  • Requires the Renderer to be in an active state.

RaycastMesh (screen coordinates)

// Return value: bool → true=hit
public bool RaycastMesh(Vector3 mousePos, out HitResult _finalResult, float _disatnce = 70.0f)

Fires a ray from screen coordinates to detect the collision mesh. Uses Collider data for detection, faster than Raycast but with lower precision.

ParameterTypeDescription
mousePosVector3Screen coordinates
_finalResultout HitResultHit result
_disatncefloatMaximum detection distance, default 70.0

Usage example:

if (m_manager.RaycastMesh(Input.mousePosition, out HitResult hit))
{
    Debug.Log(hit.hitPos);
}

Description:

  • Requires collision to be successfully enabled first.
  • Requires calling SetColliderEnable(true) first.

RaycastMesh (Ray + Bounds)

// Return value: bool → true=hit
public bool RaycastMesh(Ray ray, out HitResult result, out Bounds hitBounds, float maxDist = 70.0f)

Uses a custom Ray for collision mesh detection, and also returns the bounding box information of the hit node.

ParameterTypeDescription
rayRayThe ray
resultout HitResultHit result
hitBoundsout BoundsBounding box of the hit node (bounding box of the hit LOD node)
maxDistfloatMaximum detection distance, default 70.0

Usage example:

Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (m_manager.RaycastMesh(ray, out HitResult hit, out Bounds bounds))
{
    Debug.Log(bounds.center);
}

Description:

  • Requires collision to be successfully enabled first.
  • This method is commonly used for dual-ray detection (downward, forward) to judge whether a digital human can walk.

IntersectsSphere

// Return value: bool → true=intersect
public bool IntersectsSphere(Sphere sphere)

// Return value: bool → true=intersect
public bool IntersectsSphere(Sphere sphere, out Vector3 delta)

Detects whether a sphere intersects the collision mesh. The second overload additionally returns the penetration vector delta (push-out direction and distance), which can be used to compute the next safely reachable point.

ParameterTypeDescription
sphereSphereThe sphere to detect
deltaout Vector3Penetration vector (push-out direction and distance)

Usage example:

var sphere = new Sphere(transform.position, 0.5f);
if (m_manager.IntersectsSphere(sphere, out Vector3 delta))
{
    transform.position += delta;
}

Description:

  • Requires collision to be successfully enabled first.
  • Requires calling SetColliderEnable(true) first.
  • Iterates over all active Renderers.

IntersectsCapsule

// Return value: bool → true=intersect
public bool IntersectsCapsule(Capsule capsule)

// Return value: bool → true=intersect
public bool IntersectsCapsule(Capsule capsule, out Vector3 delta)

Detects whether a capsule intersects the collision mesh. Commonly used for character controller collision detection. The second overload returns the penetration vector delta, which can be used as the offset to the next safely reachable point for a digital human.

ParameterTypeDescription
capsuleCapsuleThe capsule to detect
deltaout Vector3Penetration vector

Usage example:

var capsule = new Capsule(footPos, headPos, 0.3f);
if (m_manager.IntersectsCapsule(capsule, out Vector3 delta))
{
    characterController.Move(delta);
}

Description:

  • Requires the data to contain collision nodes.
  • Requires calling SetColliderEnable(true) first.
  • Suitable for first-person / third-person character collision.

Raycast

// Return value: bool → true=hit
public bool Raycast(Ray _ray, out HitResult _finalResult)

Uses a custom Ray to perform ray detection on Gaussian primitives, iterating over all active Renderers and returning the nearest hit. Does not rely on the collision mesh; higher precision but slower.

ParameterTypeDescription
_rayRayThe ray
_finalResultout HitResultHit result

Usage example:

Ray ray = new Ray(origin, direction);
if (m_manager.Raycast(ray, out HitResult hit))
{
    Debug.Log(hit.hitPos);
}

Description:

  • Does not rely on the collision mesh, no need for SetColliderEnable.
  • Higher precision but slower, not recommended for per-frame calls, suitable for measurement-type applications, not suitable for digital human collision.

HitResult

The hit results of the above detection methods are returned through the HitResult struct:

public struct HitResult {
    public bool isHit;             // Whether it hit
    public float distance;         // Distance
    public Vector3 hitPos;         // Hit point world coordinates (field name is hitPos, not position)
    public Vector3 normal;         // Hit normal
    public float hitAlpha;         // Alpha of the hit ellipsoid
    public float dist2Origin;      // Distance to the ray origin
    public float scale;            // Ellipsoid scale
}

Note:

The field name of the hit point world coordinates is hitPos, not position; access it by the actual field name.