Files
Fishing2/Packages/com.jbooth.microsplat.alpha-hole/Samples~/AlphaHole/AlphaHolePhysics.cs
2025-06-04 09:09:39 +08:00

39 lines
866 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AlphaHolePhysics : MonoBehaviour {
public class ExampleClass : MonoBehaviour
{
public LayerMask disableLayer;
public Terrain terrain;
public Collider terrainCollider;
public string tagName = "Player";
void Start()
{
if (terrain != null)
{
terrainCollider = terrain.GetComponent<Collider>();
}
}
void OnTriggerEnter(Collider other)
{
if (other.CompareTag(tagName))
{
Physics.IgnoreCollision(other, terrainCollider, true);
}
}
void OnTriggerExit(Collider other)
{
if (other.CompareTag(tagName))
{
Physics.IgnoreCollision(other, terrainCollider, false);
}
}
}
}