Commit 9a37a19f authored by Haobo Wang's avatar Haobo Wang
Browse files

code to test

parent 26968b95
Pipeline #99103 failed with stage
in 1 minute and 26 seconds
......@@ -1115,6 +1115,15 @@
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "RemoteGrab",
"type": "Button",
"id": "77e92c1a-de2e-4a1b-9724-3eec1c3b681a",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
}
],
"bindings": [
......@@ -1150,6 +1159,17 @@
"action": "ModeSelect",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "ebb5b7f0-ef24-4149-a6ee-86fc62eccd5d",
"path": "<ViveController>{RightHand}/triggerPressed",
"interactions": "",
"processors": "",
"groups": "",
"action": "RemoteGrab",
"isComposite": false,
"isPartOfComposite": false
}
]
}
......
......@@ -73,7 +73,8 @@ public class ImportModels : MonoBehaviour
// loadedObject.transform.GetChild(0).gameObject.AddComponent<zoom>();
//loadedObject.transform.GetChild(0).gameObject.GetComponent<zoom>().enabled = false;
loadedObject.transform.GetChild(0).gameObject.AddComponent<GOPhysical>();
loadedObject.transform.GetChild(0).gameObject.AddComponent<XRSimpleInteractable>();
//loadedObject.transform.GetChild(0).gameObject.tag = "Interactable";
//loadedObject.transform.GetChild(0).gameObject.AddComponent<Interactable>();
loadedObject.transform.GetChild(0).gameObject.AddComponent<MeshCollider>();
......
......@@ -2,15 +2,26 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.XR.Interaction.Toolkit;
public class ExitSphere : MonoBehaviour, IPointerDownHandler
public class ExitSphere : MonoBehaviour
{
Collider m_Collider;
MeshRenderer m_GOMeshRenderer;
MeshRenderer m_MeshRenderer;
private XRSimpleInteractable m_XRSimpleInteractable = null;
Color m_Color;
private Outline m_Outline = null;
private void Awake()
{
gameObject.AddComponent<XRSimpleInteractable>();
m_XRSimpleInteractable = GetComponent<XRSimpleInteractable>();
m_XRSimpleInteractable.selectEntered.AddListener(delegate { OnSelectEnter(); });
}
// Start is called before the first frame update
void Start()
{
......@@ -24,7 +35,7 @@ public class ExitSphere : MonoBehaviour, IPointerDownHandler
m_Outline = transform.parent.parent.GetChild(0).GetComponent<Outline>();
}
public void OnPointerDown(PointerEventData eventData)
public void OnSelectEnter()
{
m_Collider.enabled = true;
m_GOMeshRenderer.material.SetFloat("_Mode", 0);
......
......@@ -2,16 +2,26 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.XR.Interaction.Toolkit;
public class GOPhysical : MonoBehaviour,IPointerDownHandler
public class GOPhysical : MonoBehaviour
{
private MeshRenderer m_MeshRenderer = null;
private bool PhysicalAxis = false;
private XRSimpleInteractable m_XRSimpleInteractable = null;
Collider m_Collider;
Color m_Color;
private Outline m_Outline = null;
private void Awake()
{
m_XRSimpleInteractable = GetComponent<XRSimpleInteractable>();
m_XRSimpleInteractable.selectEntered.AddListener(delegate { OnSelectEnter(); });
// m_XRSimpleInteractable.selectExited.AddListener(delegate { OnSelectExit(); });
}
void Start()
{
m_MeshRenderer = GetComponent<MeshRenderer>();
......@@ -33,7 +43,7 @@ public class GOPhysical : MonoBehaviour,IPointerDownHandler
}
public void OnPointerDown(PointerEventData eventData)
public void OnSelectEnter()
{
m_MeshRenderer.material.SetFloat("_Mode", 3);
//m_MeshRenderer.material.shader = Shader.Find("Transparent/Diffuse");
......
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