20240422
This commit is contained in:
commit
e0afef912e
1285 files changed
+83219
No files matched your search
@@ -0,0 +1,28 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user