3dTiles bounds and collision detection

I have 2 use cases with 3dTiles and collision detection:
1. I want to implement camera collision detection with 3d tiles, at the moment cesium only considers zoom event for collision with 3d tiles e.g. you cant zoom in to a 3dTile building, but if rotate the camera to the building you will go through the building...
I want to implement collision detection so I could do something like:

if (!collisionWith3dTiles){
   viewer.camera.lookat(...)
}

how do you suggest I should implement that? can I use the collision detection function that zoomIn does?

2. I have a city with 3d tiles building and I want to place 3d models randomly in the city, In a way that the models won't collide the buildings. the 3d tiles data set isnt static so I can't preposition my models.
Is there a way to get all the tiles in a specific area or to get some king of quadtree for the loaded tiles?
There is Cesium3DTileset.tileVisible but it doesnt seems that it fit my needs,
If there is other suggestion how I could do it they are more than welcomed :slight_smile:

working with the latest cesium version...

thx.

Generic collision detection with 3D Tiles is pretty tricky. The current camera controller reads the depth value in front of it to determine if it collides, but isn’t aware of things to the side. I don’t have a good solution right now, just a complicated one where you store bounding boxes for each building and check every frame if the camera is within those bounds. There’s a lot of details to work through, so I’m not sure if I would actually recommend doing that.

For placing models such that they don’t collide with the tileset, you would need a similar approach. Store the bounding boxes of all the buildings as part of the tileset metadata (via the batch table) and reference those before placing other models.

Bump.

Found a good solution for this or is storing the bounding boxes the way to go?

@Pontus_Nilsson we haven’t implemented a better solution for this yet.

1 Like