add package files

This commit is contained in:
VR164000
2023-06-15 09:52:08 +08:00
parent 06d41412be
commit a0b3b91879
382 changed files with 44971 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
using System;
using UnityEngine.InputSystem;
using UnityEngine.UI;
using UnityEngine;
public class LineRender : MonoBehaviour
{
[Tooltip("Root object of Line mesh")]
public GameObject Line = null;
[SerializeField] private LineRenderer GazeRayRenderer;
[SerializeField]
private InputActionReference m_ActionReferencePose;
public InputActionReference actionReferencePose { get => m_ActionReferencePose; set => m_ActionReferencePose = value; }
// Update is called once per frame
void Update()
{
Vector3 DirectionCombinedLocal;
if (actionReferencePose != null && actionReferencePose.action != null
&& actionReferencePose.action.enabled && actionReferencePose.action.controls.Count > 0)
{
//GazeRayRenderer.SetActive(true);
UnityEngine.XR.OpenXR.Input.Pose poseval = actionReferencePose.action.ReadValue<UnityEngine.XR.OpenXR.Input.Pose>();
Quaternion gazeRotation = poseval.rotation;
Quaternion orientation = new Quaternion(
1 * (gazeRotation.x),
1 * (gazeRotation.y),
1 * gazeRotation.z,
1 * gazeRotation.w);
DirectionCombinedLocal = orientation * Vector3.forward;
Vector3 DirectionCombined = Camera.main.transform.TransformDirection(DirectionCombinedLocal);
GazeRayRenderer.SetPosition(0, poseval.position);
GazeRayRenderer.SetPosition(1, poseval.position + DirectionCombinedLocal * 4);
}
}
}