Photorealistic Tileset and scene.clamToHeight

I’m using the following to clamp an entity to the height of the Google Photorealistic Tileset…

playerEntity.position = scene.clampToHeight(position, objectsToExclude);

It works great, but in a city like Seattle where trees and buildings are represented in 3D it creates a path that moves the entity over trees for example that in reality would overhang into a roadway.

Is there a method that would clamp to height of the general globe curvature for this tileset, hopefully keeping above roadways that are “at ground level” and not go over a tree that is shown overlapping a road? My guess is no, but had to ask as it’d create a much nicer moving entity in these cities with the photorealistic tiles.

I would experiment with Cesium World Terrain, which has none of the buildings or trees that are in Google Photorealistic 3D Tiles. You could clamp to the terrain plus some offset, which may get you the “above ground level roadways” that you are looking for.

Thank you. I originally created my app with World Terrain and it was/is working well using different methods of setting the location of 3D objects based on the terrain height. The Google photorealistic tiles with the 3D objects are pretty experience enhancing for what I’m doing so I’d love to use them. If it’s not functional in that way then I’ll just decide between the two, but it’d be nice to have my cake and eat it too :slight_smile:

it’d be nice to have my cake and eat it too

You could load CWT and Google’s tileset. Then clamp to CWT only. With = false;, CWT shouldn’t show.

I had experimented with that but with mixed success. My understanding is that the globe curvature is different so the models are sometimes below the 3d mesh and get clipped.

Yes, I’m not sure exactly what vertical datum Google’s Photorealistic 3D Tiles are, but I think they may be reference to a sphere. Cesium World Terrain uses a WG84 ellipsoid which would more closely approximate the earth’s shape.

You could experiment with using a spherical or ellipsoidal globe with EllipsoidTerrainProvider and offsetting height from that instead. It won’t follow terrain exactly, but should match the earth’s curvature.