huge change, new desig wip

This commit is contained in:
xpeng
2022-10-03 02:04:54 +02:00
parent fcf30caedc
commit a01f6c9152
159 changed files with 29969 additions and 28626 deletions
+4 -1
View File
@@ -1,7 +1,10 @@
{
"name": "Controller",
"rootNamespace": "",
"references": [],
"references": [
"GUID:80de51a1f88203a4cb129a5922de311f",
"GUID:fe685ec1767f73d42b749ea8045bfe43"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
@@ -2,12 +2,18 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR;
public class Controller : MonoBehaviour
public class ControllerHapticManager : MonoBehaviour
{
public XRNode Hand;
InputDevice device;
public float duration;
public float amplitude;
public float duration = 0.1f;
public float amplitude = 1f;
void Start()
{
ConfigManager.onConfigChanged += ApplyConfig;
ConfigManager.EnsureInitialization();
ApplyConfig();
}
private void OnTriggerEnter(Collider other)
{
device = InputDevices.GetDeviceAtXRNode(Hand);
@@ -18,4 +24,9 @@ public class Controller : MonoBehaviour
device = InputDevices.GetDeviceAtXRNode(Hand);
device.StopHaptics();
}
void ApplyConfig()
{
duration = ConfigManager.config.HapticDuration;
amplitude = ConfigManager.config.HapticAmplitude;
}
}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: b827d6b92c85ea44b8376851b155786b
guid: 901c50071db1c3f4fb9f655e0daeb979
MonoImporter:
externalObjects: {}
serializedVersion: 2
+36
View File
@@ -0,0 +1,36 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR.Interaction.Toolkit;
public class RayManager : MonoBehaviour
{
public bool RaySwitch = true;
public float Distance = -0.45f;
XRRayInteractor interactor;
XRInteractorLineVisual lineVisual;
LineRenderer lineRenderer;
void Start()
{
interactor = GetComponent<XRRayInteractor>();
lineVisual = GetComponent<XRInteractorLineVisual>();
lineRenderer = lineVisual.GetComponent<LineRenderer>();
}
// Update is called once per frame
void Update()
{
if (gameObject.transform.position.z > Distance || !RaySwitch)
{
interactor.enabled = false;
lineRenderer.enabled = false;
lineVisual.enabled = false;
}
else
{
interactor.enabled = true;
lineRenderer.enabled = true;
lineVisual.enabled = true;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 83408e1317bdfaa48b49a1e9e7c0cc13
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: