Colliding with Map Geometry
Example Scene
To see an example of collisions against the map:
- Open the scene
Wrld/Demo/Examples.unity
- Ensure your API key is set at least on the Collision GameObject’s Wrld Map component
- Click the Play button
- Select “Colliding with Map Geometry” from the dropdown
- Click on the map to fire a projectile into the scene
Collision Setup
You can enable collision independently for Terrain, Roads, and Buildings by ticking the checkboxes for them in the Wrld Map inspector, as shown above.
If you’re writing a custom behaviour instead of using the Wrld Map component, you can instead set these fields in the Wrld.ConfigParams object that gets passed into Wrld.Api.Create:
Performance
When collision is enabled, the API will generate collision meshes alongside the visual meshes used to draw the map. This will use more memory and add some latency to the streaming of the scene. Because of this, we recommend disabling collision for any types of objects that don’t require it.
Coordinate System
We recommend that you start the API with the UnityWorld coordinate system when using collisions. This orients the map so that the direction of gravity points down the negative Y axis for the area around the start location, which allows for more intuitive use of Unity’s physics system.
If you do want to use collision in ECEF, you will need to make sure that Unity’s gravity vector is kept up to date, to point towards the center of the earth.