class

FScanBvh

The deterministic scan hierarchy (§29 A2). Shots replicate, not points, so every client re-traces every shot — and the cloud a player sees is only shared if every client's trace returns the same hits bit for bit. Jolt and Embree cannot promise that: they are float hierarchies built in an order that follows the ECS iteration and the thread schedule, and the two of them do not even generate the same rays.

Module
Game
Header
#include "PointCloud/ScanBvh.h"
Namespace
Mowo

This one is canonical by construction: - vertices are snapped to a 1/1024 m grid as they are added, so every coordinate is exactly representable and the build never sees two machines' transform round-off; - triangles are sorted by a content key (Morton code of the snapped centroid, then the snapped vertices, then the tag), so the hierarchy is the same whatever order the level's meshes were added in; - traversal reports the nearest hit with ties broken by that canonical triangle index, so neither child order nor thread count changes a result; - a shot's rays are cast in parallel but written per ray index.

Static geometry is built once; moving bodies go into a second hierarchy rebuilt each Sync from their current transforms, deterministic as long as the transforms themselves are the replicated state.

Properties

TypeNameDescription
static constexpr floatkGridPerMetreDefault 1024.0f.
static constexpr uint32_tkLeafSizeDefault 4.

Public functions

ReturnsNameDescription
voidClear
voidAddMeshAppends a mesh's triangles, transformed to world space and snapped.
voidBuild
boolIsBuilt
uint32_tTriangleCount
uint32_tNodeCount
uint64_tContentHashFNV-1a over the canonical triangle list: two machines whose hashes match trace the same geometry.
boolIntersectNearest hit with t in (tMin, tMax).
floatSnapCoordinate

Function details

Clear

C++
void Clear()

AddMesh

C++
void AddMesh(const std::vector<Vec3>& positions, const std::vector<uint32_t>& indices, const Mat4& toWorld, FScanTag tag, uint32_t instanceId, bool dynamic, bool character = false)

Appends a mesh's triangles, transformed to world space and snapped. Degenerate triangles (zero area after snapping) are dropped.

Build

C++
void Build()

IsBuilt

C++
bool IsBuilt() const

TriangleCount

C++
uint32_t TriangleCount() const

NodeCount

C++
uint32_t NodeCount() const

ContentHash

C++
uint64_t ContentHash() const

FNV-1a over the canonical triangle list: two machines whose hashes match trace the same geometry. Valid after Build.

Intersect

C++
bool Intersect(const Vec3& origin, const Vec3& direction, float tMin, float tMax, FScanBvhHit& out) const

Nearest hit with t in (tMin, tMax).

SnapCoordinate

C++
static float SnapCoordinate(float metres)
Generated from PointCloud/ScanBvh.h via game.json · Nov 5, 2026Version 1.0.0