1
0
forked from cgvr/DeltaVR

test boxes collide with player in VR mode, too

This commit is contained in:
2025-12-15 16:57:30 +02:00
parent 7be20d249e
commit 5956b9508d
6 changed files with 13 additions and 74 deletions

View File

@@ -1,3 +1,4 @@
using Unity.XR.CoreUtils;
using UnityEngine;
public class ModelGenerationTestBox : MonoBehaviour
@@ -25,7 +26,8 @@ public class ModelGenerationTestBox : MonoBehaviour
async void OnTriggerEnter(Collider other)
{
KbmController controller = other.GetComponent<KbmController>();
if (controller != null)
XROrigin playerOrigin = other.GetComponent<XROrigin>();
if (controller != null || playerOrigin != null)
{
meshRenderer.material = activeMaterial;
@@ -41,7 +43,8 @@ public class ModelGenerationTestBox : MonoBehaviour
private void OnTriggerExit(Collider other)
{
KbmController controller = other.GetComponent<KbmController>();
if (controller != null)
XROrigin playerOrigin = other.GetComponent<XROrigin>();
if (controller != null || playerOrigin != null)
{
meshRenderer.material = inactiveMaterial;
}

View File

@@ -1,5 +1,6 @@
using System.Diagnostics;
using TMPro;
using Unity.XR.CoreUtils;
using UnityEngine;
using Whisper;
using Whisper.Utils;
@@ -42,7 +43,8 @@ public class VoiceTranscriptionTestBox : MonoBehaviour
void OnTriggerEnter(Collider other)
{
KbmController controller = other.GetComponent<KbmController>();
if (controller != null)
XROrigin playerOrigin = other.GetComponent<XROrigin>();
if (controller != null || playerOrigin != null)
{
meshRenderer.material = activeMaterial;
microphoneRecord.StartRecord();
@@ -52,7 +54,8 @@ public class VoiceTranscriptionTestBox : MonoBehaviour
private void OnTriggerExit(Collider other)
{
KbmController controller = other.GetComponent<KbmController>();
if (controller != null)
XROrigin playerOrigin = other.GetComponent<XROrigin>();
if (controller != null | playerOrigin != null)
{
meshRenderer.material = inactiveMaterial;
microphoneRecord.StopRecord();