I am having immense difficulty trying to place objects on the earth’s surface at runtime in UE5.3 with Google Photorealistic Terrain Tiles. I can correctly place an actor above the correct Longitude|Latitude coordinates… but then I need to detect and correct for height changes once the tileset has loaded and resolved its terrain height features.
I am using the methods here for both creating a camera in advance which points at the tileset and thus forces it to load… and for doing a line trace which intercepts the tileset and calculates the difference between the ground-seeking actor’s Globe Anchor Component’s current height and the fully loaded terrain’s height.
After much debugging, I have identified a couple of issues:
When I create a custom collision filtering channel and set it to default to Block… the traces register on the terrain, but also on other objects. If, however I set it to default to Ignore (in project settings)… the traces don’t register on the Google Photorealistic Terrain tileset. I believe this is because they are not a Cesium World Terrain. However, I’m not sure where to find the setting to enable Google Photorealistic Terrain Tiles to Block a custom trace channel. The Collision settings on the Cesium3DTileset instance in the level does not seem to work when set to Block on the appropriate trace channel.
Once the traces are hitting correctly (if I just default the trace channel to Block) - i.e. once the dynamic pawn or other camera is zoomed in close to the tiles - the calculations for evaluating the height offset between the trace-firing actor and the impact point on the tileset are correct (in metres). I have confirmed this using the Debug Camera’s height and comparing it to the traces.
However, once I go to add this height offset to the Globe Anchor Component of the Actor whose height I want to adjust (I want it to make it sit on the ground)… everything goes awry and the node seems to place the Actor 1000s of metres under the earth’s surface instead of directly on top of it. I’m not sure if I’m misunderstanding that I cannot add a height offset in ‘meters’ to the Z component of the <Longitude, Latitude, Height> node without a node? I understood that once I have the correct height delta in meters, I could just set that delta to the ‘Z’ component of a vector and add it to the Actor’s Globe Anchor Component’s original Height value.
Any ideas why this seemingly simple thing would not be working?