You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe. #428 (PR #468) wired Jolt HeightFieldShape collision into single-tile terrain, built once at OnPhysics3DStart from the terrain's CPU height field. Two cases are deliberately out of scope there and remain gaps:
Streamed terrain (TerrainComponent::m_StreamingEnabled / TerrainStreamer) gets no collision — BuildTerrainCollisionBody early-returns for streaming terrains. Tiles add/remove their visual mesh as the camera moves, but no collision body is created/destroyed in step, so bodies fall through streamed worlds.
Sculpt / erosion edits (TerrainBrush / TerrainErosion, which mutate TerrainData::m_Heights and report a DirtyRegion) update the GPU heightmap and chunk meshes but not the collision shape — the static heightfield body keeps the pre-edit surface.
Describe the solution you'd like
Streaming: create/destroy a static HeightFieldShape body per loaded tile, keyed on tile grid coords, hooked into the TerrainStreamer load (ProcessCompletedLoads → BuildGPUResources) and unload/evict (EvictOverBudget) lifecycle. Each tile's body uses its WorldOrigin (gridX·tileWorldSize, 0, gridZ·tileWorldSize) + per-tile TerrainData. Reuse JoltShapes::CreateTerrainHeightFieldShape + JoltScene::CreateTerrainBody/DestroyTerrainBody (already keyed by UUID — may need a per-tile key scheme).
Sculpt/erosion: on a DirtyRegion edit, update the affected collision region via JPH::HeightFieldShape::SetHeights(inX, inY, sizeX, sizeY, …). Note Jolt requires the region to be block-aligned (inX % mBlockSize == 0), so snap the dirty rect outward to the block grid. Debounce so a brush drag doesn't rebuild every frame.
Acceptance criteria
A character controller / vehicle rests on and traverses streamed terrain without falling through; collision tiles add/remove in step with the visual load/unload.
After a sculpt or erosion edit, a body dropped on the edited region rests on the new surface (collision matches the edited mesh).
Additional context
Foundation: #428 / PR #468. Conventions (scale/origin/padding, block-alignment for partial updates) are documented in that PR's JoltShapes::CreateTerrainHeightFieldShape and the JoltScene terrain-body lifecycle.
Activity
coderabbitai commentedon Jun 29, 2026
🔗 Related PRs
#78 - Feature/physics integration [closed]
#225 - Compute exact mesh collider volume and centroid [merged]
#369 - feat: Add hydraulic erosion post-pass to terrain generation [merged]
#468 - feat(physics): wire Jolt HeightFieldShape into terrain collision (
#428) [merged]#539 - fix(physics3d): route JoltScene through PhysicsSettings, fix contact-… [merged]
🧪 Issue enrichment is currently in open beta.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml:💬 Have feedback or questions? Drop into our discord!
fix(physics): address #469 review — sculpt undo/redo collision, NaN g…
Merge pull request #669 from drsnuggles8/feature/terrain-streaming-co…