Create objects with geodetic coordinates

I’m trying to create objects in the world. As of now i have done

  • interactive creation of point objects using cursor hit and adding a cesiumglobeanchor that does automatically the conversion to latlonheight ( height being computed for the currently loaded tiles). They are the horizontal postits objects on the picture
  • creation from script and geo coordinates. I create the objects with a cesiumglobe anchor, latlon set and height at zero, and then i clamp them on ground using a raycast. It works if the tiles are loaded . They are the vertical objects on the picture.

Should I update the height every time tiles are refined? To reduce workload I’ve tried to register to OnTileGameObjectCreated callback but I don’t get how to access to the 3DTile object, it’s not a MonoBehaviour. I’d like to use that to limit to the tiles bounds that contains objects. Does it sounds like a good strategy?

We don’t have a great answer for this right now. OnTileGameObjectCreated doesn’t help directly, because it’s called when the tile is created, not when a tile is activated or deactivated.

One idea - which I haven’t tried! - is to create a custom MonoBehaviour just to receive the enable/disable events. In OnTileGameObjectCreated, attach your custom MonoBehaviour to the tile GameObject. Then, handle the OnEnable and OnDisable Unity events in your custom MonoBehaviour to be notified when that tile becomes visible or invisible. You can probably use the Mesh’s bounds property (get the mesh from the MeshFilter MonoBehaviour) to limit the amount of recomputation.

1 Like

That’s sounds good, thank you. The bounds are tilted according to globe so I’m a bit concerned for objects with a height above ground but that could do the trick for ground objects.


Another way would be to attach a component on native side to provide unity with the tile footprint in ECEF coordinates. Do you think it’s feasible?

Those bounding boxes will probably be a better fit for the tiles when the tiles are near the Georeference origin. That will help with precision, too, so you might want to use the CesiumOriginShift component if you’re not already.

As far as providing an ECEF bounding box from the native side? Sure, it’s possible. You probably don’t need a whole component for it, just a function will do. Also a bounding box aligned to the ECEF axes might not actually be very tight-fitting either. I guess what you really want is what we call a BoundingRegion. It’s west/south/east/north bounds plus minimum and maximum height.

1 Like

BoundingRegion sounds perfect - but I’m not sure where to put this function, I’m looking for a tile or tileinfo component, I may be missing something.

Unless I put this function in CesiumGlobeAnchor, and that doesn’t look the best match