Initial Commit

This commit is contained in:
Toomas Tamm
2020-11-28 16:54:41 +02:00
parent 97292ee26e
commit ea967135f2
4217 changed files with 2945663 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR;
namespace UnityXR
{
public class HandPresence : MonoBehaviour
{
private InputDevice _targetDevice;
// Start is called before the first frame update
void Start()
{
List<InputDevice> devices = new List<InputDevice>();
InputDeviceCharacteristics rightControllerCharacteristics =
InputDeviceCharacteristics.Right | InputDeviceCharacteristics.Controller;
if (devices.Count > 0)
{
_targetDevice = devices[0];
}
}
// Update is called once per frame
void Update()
{
;
if (_targetDevice.TryGetFeatureValue(CommonUsages.primaryButton, out bool primaryButtonValue) &&
primaryButtonValue)
{
Debug.Log("Pressing primary button");
}
if (_targetDevice.TryGetFeatureValue(CommonUsages.trigger, out float triggerValue) && triggerValue > 0.1f)
{
Debug.Log("Trigger pressed " + triggerValue);
}
if (_targetDevice.TryGetFeatureValue(CommonUsages.primary2DAxis, out Vector2 primary2DAxisValue) &&
primary2DAxisValue != Vector2.zero)
{
Debug.Log("primary2DAxis pressed " + triggerValue);
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: df6b462fef11acb4fb7d56a91c73b4b5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,19 @@
using UnityEngine;
using UnityEngine.XR.Interaction.Toolkit;
namespace UnityXR
{
public class TeleportWorldArea : TeleportationArea
{
// Override the teleport request to use the world rotation and not our gameObject's transform
protected override bool GenerateTeleportRequest(XRBaseInteractor interactor, RaycastHit raycastHit,
ref TeleportRequest teleportRequest)
{
teleportRequest.destinationPosition = raycastHit.point;
teleportRequest.destinationUpVector = Vector3.up; // use the area transform for data.
teleportRequest.destinationForwardVector = Vector3.forward;
teleportRequest.destinationRotation = Quaternion.identity;
return true;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9bc374ab13b4e224384b965358d295cb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: