1
0
forked from cgvr/DeltaVR

microphone stand has separate enter and exit proximity triggers

This commit is contained in:
2026-02-28 15:18:57 +02:00
parent 9d780f4dbc
commit d6a63a5de6
10 changed files with 269 additions and 453 deletions

View File

@@ -0,0 +1,27 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MicrophoneProximityTrigger : MonoBehaviour
{
public MicrophoneStand mic;
public bool isEnter;
private void OnTriggerEnter(Collider other)
{
if (isEnter && other.gameObject.tag == "Player Head")
{
Debug.Log("collided with: " + other.gameObject.name);
mic.OnPlayerApproach();
}
}
private void OnTriggerExit(Collider other)
{
if (!isEnter && other.gameObject.tag == "Player Head")
{
Debug.Log("collider left with: " + other.gameObject.name);
mic.OnPlayerLeave();
}
}
}