实现功能侧握键抓取物体 双手可交换 再次按下侧握键放下
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Valve.VR.InteractionSystem;
using Valve.VR;
[RequireComponent(typeof(Interactable))]
[RequireComponent(typeof(Rigidbody))]
public class PlayerGrab : MonoBehaviour
{
[EnumFlags]
[Tooltip("The flags used to attach this object to the hand.")]
public Hand.AttachmentFlags attachmentFlags = Hand.AttachmentFlags.ParentToHand | Hand.AttachmentFlags.DetachFromOtherHand | Hand.AttachmentFlags.TurnOnKinematic;
protected Interactable _interactable;
[Tooltip("When detaching the object, should it return to its original parent?")]
public bool restoreOriginalParent = false;
private void Awake()
{
_interactable = this.GetComponent<Interactable>();
}
/// <summary>
/// 手进入物体中更新检测
/// </summary>
/// <param name="hand">&