MapsSDK-Unity icon indicating copy to clipboard operation
MapsSDK-Unity copied to clipboard

Accurate Terrain Colliders

Open drewmassey-bah opened this issue 6 years ago • 7 comments

Some of the tools that we use require accurate collider components attached to the 3D scenes (i.e. mesh colliders).

The ability to have accurate colliders on the terrain and buildings would allow the tools that we've developed to be able to interact correctly with the terrain. It would also allow for us to do first person walkthroughs on the terrain.

drewmassey-bah avatar May 22 '19 21:05 drewmassey-bah

Version 0.2.0 adds a Raycast API to the MapRenderer. It may help solve some of these scenarios. You could use this to shoot a ray down into the map and detect the distance to the map surface.

While it's unlikely we will be able to add colliders to the current MapRenderer due to how dynamic the geometry is, we can revisit this for immersive mode. Here, the map is no longer clipped, so providing a mesh collider could be feasible.

kircher1 avatar May 28 '19 23:05 kircher1

For the Raycast API, is that something that can be configured on the Map Renderer component itself, or is it something that allows a new script to use Raycasting to interact with the map?

Real time collider generation is a pretty difficult problem. I think to what you are talking about with immersive mode you can generate the mesh and feed it into a Mesh Collider component. A possible solution could be to clip the displayed map from the map renderer and then feed the mesh geometry into the Mesh Collider component.

drewmassey-bah avatar May 30 '19 12:05 drewmassey-bah

The raycast API is something you'd have to call on the instance of a MapRenderer via a script, e.g. mapRenderer.Raycast(ray, out result).

In the current rendering mode of the map, the underlying meshes that are being rendered could be clipped differently from frame-to-frame, e.g. when the map center is moving (animating/panning/zooming) the region of the map being clipped is constantly changing. To accurately represent the map with a mesh collider then, it would require regenerating the mesh collider anytime the map terrain changes, i.e. every frame. This would be a prohibitively large perf hit for common scenarios.

For immersive mode, there's no clipping going on, so we could use MeshColliders directly for each tile of the map. That should be more straightforward since you just need to generate the mesh collider once for each tile.

kircher1 avatar Jun 05 '19 16:06 kircher1

Any updates on this? Is inmmersive mode already supported? I can't find any reference to it in the examples from the latest build. (Thanks, this is impressive work)

MephestoKhaan avatar Jul 17 '19 15:07 MephestoKhaan

Immersive mode is not supported. We'll make some noise once we have it available.

kircher1 avatar Jul 17 '19 18:07 kircher1

Do you have a rough eta? How can I help? I would love to move certain app I am developing with a different map provider to this one...

MephestoKhaan avatar Jul 17 '19 18:07 MephestoKhaan

Hi, Noob here... am I right in thinking that if this request was supported - it would allow objects to collide with buildings etc? Thanks

samdemmyhardy2 avatar Dec 07 '19 04:12 samdemmyhardy2