Commit 73490a3f authored by Haobo38's avatar Haobo38
Browse files

teleport update

parent 2b2e18a0
Pipeline #96561 failed with stage
in 1 minute and 12 seconds
......@@ -1090,7 +1090,7 @@
"id": "4d58ab90-2df1-4cb5-9b20-1dcbc3e0633a",
"actions": [
{
"name": "OpenMenu",
"name": "ImportModels",
"type": "Button",
"id": "5936d029-9836-423e-8558-f5fc71a61b97",
"expectedControlType": "Button",
......@@ -1106,6 +1106,15 @@
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "ModeSelect",
"type": "Button",
"id": "fccd4436-2714-4a54-9851-a73333e58d6c",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
}
],
"bindings": [
......@@ -1116,7 +1125,7 @@
"interactions": "",
"processors": "",
"groups": "",
"action": "OpenMenu",
"action": "ImportModels",
"isComposite": false,
"isPartOfComposite": false
},
......@@ -1130,6 +1139,17 @@
"action": "Teleport",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "157d7640-3624-425b-8f44-eac52501de52",
"path": "<ViveController>{LeftHand}/gripPressed",
"interactions": "",
"processors": "",
"groups": "",
"action": "ModeSelect",
"isComposite": false,
"isPartOfComposite": false
}
]
}
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.XR.Interaction.Toolkit;
using DG.Tweening;
public class MenuManagement : MonoBehaviour
{
public InputActionReference importModelsReference = null;
public InputActionReference modeSelectReference = null;
public GameObject rightHandController = null;
private bool importModels = false;
private bool modeSelect = false;
private Vector3 menuImportModelsScale;
private Vector3 menuModeSelectScale;
private void Awake()
{
importModelsReference.action.started += ImportModels;
modeSelectReference.action.started += ModeSelect;
// transform.GetChild(0).gameObject.SetActive(false);
// menuImportModelsScale = transform.GetChild(0).gameObject.transform.localScale;
menuImportModelsScale = transform.GetChild(0).transform.GetChild(0).transform.localScale;
transform.GetChild(0).transform.GetChild(0).transform.localScale = new Vector3(0, 0, 0);
menuModeSelectScale = transform.GetChild(0).transform.GetChild(1).transform.localScale;
transform.GetChild(0).transform.GetChild(1).transform.localScale = new Vector3(0, 0, 0);
}
private void OnDestroy()
{
importModelsReference.action.started -= ImportModels;
modeSelectReference.action.started -= ModeSelect;
}
private void ImportModels(InputAction.CallbackContext context)
{
/*bool isActive = !transform.GetChild(0).gameObject.activeSelf;
GetComponent<XRRayInteractor>().enabled = transform.GetChild(0).gameObject.activeSelf;
transform.GetChild(0).gameObject.SetActive(isActive);*/
if (!importModels)
{
GetComponent<XRRayInteractor>().enabled = false;
if (modeSelect)
{
transform.GetChild(0).transform.GetChild(1).transform.localScale = new Vector3(0, 0, 0);
modeSelect = false;
}
// transform.GetChild(0).gameObject.SetActive(true);
// transform.GetChild(0).gameObject.transform.localScale = new Vector3(0, 0, 0);
transform.GetChild(0).transform.GetChild(0).transform.DOScale(menuImportModelsScale, 0.5f);
importModels = true;
}
else
{
transform.GetChild(0).transform.GetChild(0).transform.DOScale(0, 0.5f);
// transform.GetChild(0).gameObject.SetActive(false);
GetComponent<XRRayInteractor>().enabled = true;
importModels = false;
}
}
private void ModeSelect(InputAction.CallbackContext context)
{
/*bool isActive = !transform.GetChild(0).gameObject.activeSelf;
GetComponent<XRRayInteractor>().enabled = transform.GetChild(0).gameObject.activeSelf;
transform.GetChild(0).gameObject.SetActive(isActive);*/
if (!modeSelect)
{
GetComponent<XRRayInteractor>().enabled = false;
if (importModels)
{
transform.GetChild(0).transform.GetChild(0).transform.localScale = new Vector3(0, 0, 0);
importModels = false;
}
// transform.GetChild(0).gameObject.SetActive(true);
// transform.GetChild(0).gameObject.transform.localScale = new Vector3(0, 0, 0);
transform.GetChild(0).transform.GetChild(1).transform.DOScale(menuModeSelectScale, 0.5f);
modeSelect = true;
}
else
{
transform.GetChild(0).transform.GetChild(1).transform.DOScale(0, 0.5f);
//transform.GetChild(0).gameObject.SetActive(false);
GetComponent<XRRayInteractor>().enabled = true;
modeSelect = false;
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ModeManagement : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
fileFormatVersion: 2
guid: 3ee9d6d9be526974aab177cba1e06d3a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.XR.Interaction.Toolkit;
using DG.Tweening;
public class OpenMenu : MonoBehaviour
{
public InputActionReference openMenuReference = null;
private bool openMenu = false;
private Vector3 menuScale;
private void Awake()
{
openMenuReference.action.started += Open;
// transform.GetChild(0).gameObject.SetActive(false);
menuScale = transform.GetChild(0).gameObject.transform.localScale;
transform.GetChild(0).gameObject.transform.localScale = new Vector3(0, 0, 0);
}
private void OnDestroy()
{
openMenuReference.action.started -= Open;
}
private void Open(InputAction.CallbackContext context)
{
/*bool isActive = !transform.GetChild(0).gameObject.activeSelf;
GetComponent<XRRayInteractor>().enabled = transform.GetChild(0).gameObject.activeSelf;
transform.GetChild(0).gameObject.SetActive(isActive);*/
if (!openMenu)
{
GetComponent<XRRayInteractor>().enabled = false;
// transform.GetChild(0).gameObject.SetActive(true);
// transform.GetChild(0).gameObject.transform.localScale = new Vector3(0, 0, 0);
transform.GetChild(0).gameObject.transform.DOScale(menuScale, 0.5f);
openMenu = true;
}
else
{
transform.GetChild(0).gameObject.transform.DOScale(0, 0.5f);
// transform.GetChild(0).gameObject.SetActive(false);
GetComponent<XRRayInteractor>().enabled = true;
openMenu = false;
}
}
}
......@@ -2,10 +2,13 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.XR.Interaction.Toolkit;
public class TeleportationManager : MonoBehaviour
{
[SerializeField] private InputActionAsset actionAsset;
private InputAction _thumbstick;
[SerializeField] private XRRayInteractor xRRayInteractor;
// Start is called before the first frame update
void Start()
......@@ -16,6 +19,8 @@ public class TeleportationManager : MonoBehaviour
cancel.Enable();
_thumbstick = actionAsset.FindActionMap("XRI RightHand Locomotion").FindAction("Move");
_thumbstick.Enable();
xRRayInteractor.lineType = XRRayInteractor.LineType.StraightLine;
}
// Update is called once per frame
......
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3224840560302698859
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2308148805056478388}
m_Layer: 0
m_Name: Recticle
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2308148805056478388
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3224840560302698859}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 6346524894072717499}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &2625720990533018473
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 2308148805056478388}
m_Modifications:
- target: {fileID: 8963022596687864786, guid: 39d039c76a28ef0429b922033d0611cb, type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8963022596687864786, guid: 39d039c76a28ef0429b922033d0611cb, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8963022596687864786, guid: 39d039c76a28ef0429b922033d0611cb, type: 3}
propertyPath: m_LocalPosition.y
value: 0.0005
objectReference: {fileID: 0}
- target: {fileID: 8963022596687864786, guid: 39d039c76a28ef0429b922033d0611cb, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8963022596687864786, guid: 39d039c76a28ef0429b922033d0611cb, type: 3}
propertyPath: m_LocalRotation.w
value: 0.7071068
objectReference: {fileID: 0}
- target: {fileID: 8963022596687864786, guid: 39d039c76a28ef0429b922033d0611cb, type: 3}
propertyPath: m_LocalRotation.x
value: -0.7071068
objectReference: {fileID: 0}
- target: {fileID: 8963022596687864786, guid: 39d039c76a28ef0429b922033d0611cb, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8963022596687864786, guid: 39d039c76a28ef0429b922033d0611cb, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8963022596687864786, guid: 39d039c76a28ef0429b922033d0611cb, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: -90
objectReference: {fileID: 0}
- target: {fileID: 8963022596687864786, guid: 39d039c76a28ef0429b922033d0611cb, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8963022596687864786, guid: 39d039c76a28ef0429b922033d0611cb, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8968360277835186212, guid: 39d039c76a28ef0429b922033d0611cb, type: 3}
propertyPath: m_Name
value: TeleportReticle
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 39d039c76a28ef0429b922033d0611cb, type: 3}
--- !u!4 &6346524894072717499 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 8963022596687864786, guid: 39d039c76a28ef0429b922033d0611cb, type: 3}
m_PrefabInstance: {fileID: 2625720990533018473}
m_PrefabAsset: {fileID: 0}
fileFormatVersion: 2
guid: 2afb664bf607eef47982e466af0698f8
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1639319533735882
--- !u!1 &8968360277835186212
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
......@@ -8,9 +8,9 @@ GameObject:
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4744717297085500}
- component: {fileID: 33196478885146148}
- component: {fileID: 23553092305010376}
- component: {fileID: 8963022596687864786}
- component: {fileID: 8936873247028437450}
- component: {fileID: 8944284866344644902}
m_Layer: 0
m_Name: TeleportReticle
m_TagString: Untagged
......@@ -18,35 +18,35 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4744717297085500
--- !u!4 &8963022596687864786
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1639319533735882}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -6, y: 0.05, z: 0}
m_GameObject: {fileID: 8968360277835186212}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 100, y: 100, z: 100}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &33196478885146148
--- !u!33 &8936873247028437450
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1639319533735882}
m_GameObject: {fileID: 8968360277835186212}
m_Mesh: {fileID: 4300000, guid: a9e891d1e1a9cb141b96aebaaee994cc, type: 3}
--- !u!23 &23553092305010376
--- !u!23 &8944284866344644902
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1639319533735882}
m_GameObject: {fileID: 8968360277835186212}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 1
......
fileFormatVersion: 2
guid: cfb27f702a3af894b918c1816366ee19
timeCreated: 1480897488
licenseType: Free
NativeFormatImporter:
guid: 39d039c76a28ef0429b922033d0611cb
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
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