Line Trace Secrets to Hit World Terrain Runtime / Spawn in Ground

Hi Folks.
I’m using Unreal 5.1 and would like to know.

Is there any secret to making the line trace hit the ground :earth_africa: in Runtime?
Before doing it, I saw the forum until the good suggestion of doing the Line Trace from top to bottom.

But I tried all “Line Traces”, Byprofile, By Channel, Componnets, For Objects. Activate after about 15 seconds for the terrain to load.

Basically I’m doing this.
Spawn an actor, add the Globe Anchor, move it with the coordinates of a data table, create the line trace at that position, get the Out Hit Location just from Z, and transform the actor just from Z.

I used Simulation (which leaves the terrain full of holes, but the same thing happens in Play mode) and placed some plans below Cesium World Terrain to test. The system is working, I just couldn’t make it hit Cesium World Terrain.

Got any secrets?

Everything you gave me worked very well! Thanks! :upside_down_face:
I just got stuck here because of the line trace.

Let’s start with this:

I used Simulation (which leaves the terrain full of holes, but the same thing happens in Play mode)

Neither Simulation nor Play mode should leave the terrain full of holes; certainly not for very long at least. Is your camera perhaps not actually representative of the view, so the wrong tiles are being selected?

If you’re purposely trying to line trace “off screen”, then it may be necessary to disable frustum culling in the tile selection. It’s an option on the Cesium3DTileset. Or use the CesiumCameraManager to add a virtual camera to load the tiles you need.

Thanks @Kevin_Ring
Frustum Culling solved the problem! :white_check_mark:
The holes happened in Simulate, but I don’t know why. But it doesn’t affect me.

I read your post now about Frustum Culling to understand. Does it have any performance impact disabling it?

I believe in Simulate mode, Unreal basically runs your project in the same way as Play mode, but then it allows you to explore the level with an Editor camera rather than the ones built into your level. Cesium for Unreal won’t include this special simulation mode editor camera for tile selection, so it’s kind of like your editor viewport gets to observe the level without influencing it.

Disabling frustum culling requires more tiles to be loaded and rendered, so that will have some performance impact. If you need to do line traces to off-screen tiles, though, it’s unavoidable to have those extra, non-visible tiles loaded.

1 Like