forked from cgvr/DeltaVR
test boxes collide with player in VR mode, too
This commit is contained in:
@@ -17,6 +17,7 @@ public class ContinuoslocomotionConfigurator : MonoBehaviour
|
||||
turnOnButton.onClick.AddListener(enableLocomotion);
|
||||
turnOffButton.onClick.AddListener(disableLocomotion);
|
||||
turnOffButton.gameObject.SetActive(false); // off by default
|
||||
enableLocomotion();
|
||||
}
|
||||
public void UpdateSpeed(float speed)
|
||||
{
|
||||
|
||||
@@ -4262,7 +4262,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &9206012036671205809
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -5926,7 +5926,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!224 &8444771935628625875
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
using System.Diagnostics;
|
||||
using UnityEngine;
|
||||
using Whisper;
|
||||
using Whisper.Utils;
|
||||
|
||||
public class VoiceTranscription : MonoBehaviour
|
||||
{
|
||||
public WhisperManager whisper;
|
||||
public MicrophoneRecord microphoneRecord;
|
||||
|
||||
private string _buffer;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
whisper.OnNewSegment += OnNewSegment;
|
||||
|
||||
microphoneRecord.OnRecordStop += OnRecordStop;
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private async void OnRecordStop(AudioChunk recordedAudio)
|
||||
{
|
||||
_buffer = "";
|
||||
|
||||
var sw = new Stopwatch();
|
||||
sw.Start();
|
||||
|
||||
var res = await whisper.GetTextAsync(recordedAudio.Data, recordedAudio.Frequency, recordedAudio.Channels);
|
||||
if (res == null)
|
||||
return;
|
||||
|
||||
var time = sw.ElapsedMilliseconds;
|
||||
var rate = recordedAudio.Length / (time * 0.001f);
|
||||
UnityEngine.Debug.Log($"Time: {time} ms\nRate: {rate:F1}x");
|
||||
|
||||
var text = res.Result;
|
||||
|
||||
UnityEngine.Debug.Log(text);
|
||||
}
|
||||
|
||||
private void OnNewSegment(WhisperSegment segment)
|
||||
{
|
||||
_buffer += segment.Text;
|
||||
UnityEngine.Debug.Log(_buffer + "...");
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: af83274dbfe8bab4599dda694e2545c2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user