third person teleporting, grab interactables
This commit is contained in:
39
Assets/Project Files/Scripts/Helar/Inventory.cs
Normal file
39
Assets/Project Files/Scripts/Helar/Inventory.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.XR.Interaction.Toolkit;
|
||||
|
||||
[Serializable]
|
||||
[RequireComponent(typeof(XRSocketInteractor))]
|
||||
public class Inventory : MonoBehaviour
|
||||
{
|
||||
public int slots = 1;
|
||||
private List<int> _inv;
|
||||
private XRSocketInteractor xrSocketInteractor;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
xrSocketInteractor = GetComponent<XRSocketInteractor>();
|
||||
_inv = new List<int>(slots);
|
||||
var oldestInteractableSelected = xrSocketInteractor.GetOldestInteractableSelected();
|
||||
|
||||
|
||||
xrSocketInteractor.selectEntered.AddListener(Call);
|
||||
|
||||
xrSocketInteractor.hoverEntered.AddListener(Call);
|
||||
}
|
||||
|
||||
private void Call(HoverEnterEventArgs arg0)
|
||||
{
|
||||
Debug.Log("hoverenter "+arg0.interactableObject + " " + xrSocketInteractor.hasHover + " " + xrSocketInteractor.hasSelection);
|
||||
|
||||
}
|
||||
|
||||
private void Call(SelectEnterEventArgs arg0)
|
||||
{
|
||||
Debug.Log("selectenter "+arg0.interactableObject);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user