Working EyeTracking with moving Hitpoint
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using GhostSystem;
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Unity.Netcode;
|
||||
using UnityEngine;
|
||||
@@ -10,6 +11,9 @@ public class LocalPlayerReference : NetworkBehaviour
|
||||
|
||||
public List<Transform> myObjects;
|
||||
|
||||
public EyeTrackingCollisionPoints collisionPoints;
|
||||
|
||||
public static event Action OnPlayerReady;
|
||||
public override void OnNetworkSpawn()
|
||||
{
|
||||
if (IsOwner)
|
||||
@@ -27,6 +31,9 @@ public class LocalPlayerReference : NetworkBehaviour
|
||||
ghostRecorder.TrackedObjects.Add(obj);
|
||||
}
|
||||
}
|
||||
ghostRecorder.TrackedObjects.Add(collisionPoints.SpawnHitPoint());
|
||||
OnPlayerReady?.Invoke();
|
||||
Debug.LogError("Invoked OnPlayerReady");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,8 +42,10 @@ public class OVRStickAndRoomscaleMovement : NetworkBehaviour
|
||||
characterController.center = new Vector3(headLocalPos.x, height / 2f + characterController.skinWidth, headLocalPos.z);
|
||||
|
||||
// 4. Stick Movement
|
||||
Vector2 input = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick);
|
||||
Vector3 move = cameraTransform.forward * input.y + cameraTransform.right * input.x;
|
||||
Vector2 inputPos = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick);
|
||||
Vector2 inputRot = OVRInput.Get(OVRInput.Axis2D.SecondaryThumbstick);
|
||||
|
||||
Vector3 move = cameraTransform.forward * inputPos.y + cameraTransform.right * inputPos.x;
|
||||
move.y = 0;
|
||||
move.Normalize();
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using GhostSystem;
|
||||
|
||||
public class VRDebugger : MonoBehaviour
|
||||
{
|
||||
public TMP_Text trackedObjects;
|
||||
public TMP_Text recording;
|
||||
|
||||
public EyeTrackingCollisionPoints collisionPoints;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
LocalPlayerReference.OnPlayerReady += GetTrackedObjects;
|
||||
GhostRecorderBatch.OnRecord += RecordingStart;
|
||||
GhostRecorderBatch.OnStopRecord += RecordingStop;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
LocalPlayerReference.OnPlayerReady -= GetTrackedObjects;
|
||||
GhostRecorderBatch.OnRecord -= RecordingStart;
|
||||
GhostRecorderBatch.OnStopRecord -= RecordingStop;
|
||||
}
|
||||
|
||||
private void GetTrackedObjects()
|
||||
{
|
||||
GhostRecorderBatch ghostRecorder = FindFirstObjectByType<GhostRecorderBatch>();
|
||||
foreach (var obj in ghostRecorder.TrackedObjects)
|
||||
{
|
||||
trackedObjects.text += "\n\r" + obj;
|
||||
}
|
||||
}
|
||||
|
||||
private void RecordingStart()
|
||||
{
|
||||
recording.color = Color.white;
|
||||
recording.text = "Recording...";
|
||||
}
|
||||
|
||||
private void RecordingStop()
|
||||
{
|
||||
recording.color = Color.white;
|
||||
recording.text = "...";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 453b0f3c2406dc34dab9b42b8d2eb386
|
||||
Reference in New Issue
Block a user