Commit f02b1e38 authored by Haobo38's avatar Haobo38
Browse files

changeOfteleportFromInteractionOK

parent 16633393
Pipeline #103711 failed with stage
in 9 seconds
......@@ -1727,7 +1727,7 @@ MonoBehaviour:
serializedVersion: 2
m_Bits: 4294967295
m_InteractionLayers:
m_Bits: 1
m_Bits: 16
m_SelectMode: 1
m_CustomReticle: {fileID: 1639319533735882, guid: cfb27f702a3af894b918c1816366ee19, type: 3}
m_FirstHoverEntered:
......@@ -2547,6 +2547,7 @@ GameObject:
- component: {fileID: 919290643}
- component: {fileID: 919290642}
- component: {fileID: 919290646}
- component: {fileID: 919290647}
m_Layer: 0
m_Name: LeftHand Controller
m_TagString: Untagged
......@@ -2787,7 +2788,7 @@ MonoBehaviour:
serializedVersion: 2
m_Bits: 4294967295
m_InteractionLayers:
m_Bits: 4294967295
m_Bits: 15
m_AttachTransform: {fileID: 2017942439}
m_KeepSelectedTargetValid: 1
m_StartingSelectedInteractable: {fileID: 0}
......@@ -3057,6 +3058,19 @@ MonoBehaviour:
m_EditorClassIdentifier:
importModelsReference: {fileID: -1694199693176385665, guid: c348712bda248c246b8c49b3db54643f, type: 3}
rightHandController: {fileID: 932740377}
--- !u!114 &919290647
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 919290640}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 155d110ef7d1ba84aab03daa8762c495, type: 3}
m_Name:
m_EditorClassIdentifier:
xrNode: 4
--- !u!1 &932740377
GameObject:
m_ObjectHideFlags: 0
......@@ -3072,6 +3086,7 @@ GameObject:
- component: {fileID: 932740379}
- component: {fileID: 932740384}
- component: {fileID: 932740383}
- component: {fileID: 932740385}
m_Layer: 0
m_Name: RightHand Controller
m_TagString: Untagged
......@@ -3311,7 +3326,7 @@ MonoBehaviour:
serializedVersion: 2
m_Bits: 4294967295
m_InteractionLayers:
m_Bits: 4294967295
m_Bits: 4294967279
m_AttachTransform: {fileID: 914114376}
m_KeepSelectedTargetValid: 1
m_StartingSelectedInteractable: {fileID: 0}
......@@ -3372,7 +3387,7 @@ MonoBehaviour:
m_PlayHapticsOnHoverCanceled: 0
m_HapticHoverCancelIntensity: 0
m_HapticHoverCancelDuration: 0
m_LineType: 1
m_LineType: 0
m_BlendVisualLinePoints: 1
m_MaxRaycastDistance: 30
m_RayOriginTransform: {fileID: 0}
......@@ -3598,6 +3613,19 @@ Rigidbody:
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!114 &932740385
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 932740377}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 155d110ef7d1ba84aab03daa8762c495, type: 3}
m_Name:
m_EditorClassIdentifier:
xrNode: 5
--- !u!1 &963194225
GameObject:
m_ObjectHideFlags: 0
......@@ -4787,7 +4815,7 @@ MonoBehaviour:
serializedVersion: 2
m_Bits: 4294967295
m_InteractionLayers:
m_Bits: 1
m_Bits: 16
m_SelectMode: 1
m_CustomReticle: {fileID: 3224840560302698859, guid: 2afb664bf607eef47982e466af0698f8, type: 3}
m_FirstHoverEntered:
......@@ -5208,7 +5236,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &1658469758
RectTransform:
m_ObjectHideFlags: 0
......@@ -5311,7 +5339,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!114 &1682379948
MonoBehaviour:
m_ObjectHideFlags: 0
......@@ -6778,9 +6806,9 @@ RectTransform:
m_Father: {fileID: 4283870119206869357}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 50, y: -50}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!65 &2618598991219457628
......@@ -7037,9 +7065,9 @@ RectTransform:
m_Father: {fileID: 4283870119206869357}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 50, y: -710}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &4283870118829329843
......@@ -7155,9 +7183,9 @@ RectTransform:
m_Father: {fileID: 4283870119206869357}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 50, y: -820}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &4283870118924682281
......@@ -7364,7 +7392,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 1.9990593, y: 0.000015258789}
m_SizeDelta: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 870}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &4283870119206869358
MonoBehaviour:
......@@ -7444,8 +7472,8 @@ RectTransform:
m_Father: {fileID: 4283870120437604246}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 0.1551723}
m_AnchorMax: {x: 1, y: 0.8448274}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 20, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
......@@ -7689,9 +7717,9 @@ RectTransform:
m_Father: {fileID: 4283870119206869357}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 50, y: -270}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &4283870119593389983
......@@ -7807,9 +7835,9 @@ RectTransform:
m_Father: {fileID: 4283870119206869357}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 50, y: -490}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &4283870119805495377
......@@ -7963,9 +7991,9 @@ RectTransform:
m_Father: {fileID: 4283870119206869357}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 50, y: -600}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &4283870119849545571
......@@ -8193,9 +8221,9 @@ RectTransform:
m_Father: {fileID: 4283870119206869357}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 50, y: -160}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &4283870120007089600
......@@ -8563,9 +8591,9 @@ RectTransform:
m_Father: {fileID: 4283870119206869357}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 50, y: -380}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4283870120468085533
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine.XR.Interaction.Toolkit;
using UnityEngine;
using UnityEngine.XR;
using System.Linq;
using InputDeviceXR = UnityEngine.XR.InputDevice;
public class TeleportationRayCastTest: MonoBehaviour
{
[SerializeField]
private XRNode xrNode = XRNode.LeftHand;
private List<InputDevice> devices = new List<InputDevice>();
private InputDevice device;
bool buttonAction = false;
bool buttonbeforeAction = false;
private XRRayInteractor xRRayInteractor;
private string[] layerNames;
// Start is called before the first frame update
void GetDevice()
{
InputDevices.GetDevicesAtXRNode(xrNode, devices);
device = devices.FirstOrDefault();
}
void Start()
{
layerNames = new string[4];
layerNames[0] = "Port";
layerNames[1] = "Default";
layerNames[2] = "Lifecycle";
layerNames[3] = "Model";
xRRayInteractor = GetComponent<XRRayInteractor>();
// xRRayInteractor.lineType = XRRayInteractor.LineType.StraightLine;
//xRRayInteractor.interactionLayers = default;
// xRRayInteractor.interactionLayers = InteractionLayerMask.GetMask("Ground");
}
// Update is called once per frame
private void LateUpdate()
{
if (!device.isValid)
{
Debug.Log("getdevice failed");
GetDevice();
}
device.TryGetFeatureValue(CommonUsages.primary2DAxisClick, out buttonAction);
if (buttonAction == true && buttonbeforeAction == false)
{
if (device.TryGetFeatureValue(CommonUsages.primary2DAxisClick, out buttonAction) && buttonAction)
teleportCast();
Debug.Log("testing selectEnter funcion OK");
}
if (buttonAction == false && buttonbeforeAction == true)
{
interactionCast();
Debug.Log("testing selectExit funcion OK");
}
buttonbeforeAction = buttonAction;
}
public void teleportCast()
{
xRRayInteractor.lineType = XRRayInteractor.LineType.ProjectileCurve;
xRRayInteractor.interactionLayers = InteractionLayerMask.GetMask("Ground");
}
public void interactionCast()
{
xRRayInteractor.lineType = XRRayInteractor.LineType.StraightLine;
xRRayInteractor.interactionLayers = InteractionLayerMask.GetMask(layerNames);
}
}
fileFormatVersion: 2
guid: 155d110ef7d1ba84aab03daa8762c495
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -17,7 +17,7 @@ MonoBehaviour:
- Lifecycle
- Model
- Port
-
- Ground
-
-
-
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment