You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
598 B
28 lines
598 B
namespace Mapbox.Unity.Map
|
|
{
|
|
using System;
|
|
using Mapbox.Unity.MeshGeneration.Data;
|
|
using UnityEngine;
|
|
[Serializable]
|
|
public class TerrainColliderOptions : MapboxDataProperty
|
|
{
|
|
[Tooltip("Add Unity Physics collider to terrain tiles, used for detecting collisions etc.")]
|
|
public bool addCollider = false;
|
|
|
|
public override void UpdateProperty(UnityTile tile)
|
|
{
|
|
var existingCollider = tile.Collider;
|
|
if (addCollider)
|
|
{
|
|
if (existingCollider == null)
|
|
{
|
|
tile.gameObject.AddComponent<MeshCollider>();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
tile.Collider.Destroy();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|