Looking-Glass/Assets/playerstuff/SwapLeftHandToGlass.cs
2024-02-07 19:26:35 +00:00

29 lines
819 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// swaps the players left hand between being a regular controller and holding the looking glass. when holding the looking glass this hands ray interactor is also disabled
public class SwapLeftHandToGlass : MonoBehaviour
{
public GameObject raycaster;
public GameObject controller1;
public GameObject controller2;
bool glassenabled = false;
public void Swap()
{
if(!glassenabled){
raycaster.SetActive(false);
controller1.SetActive(false);
controller2.SetActive(true);
}
else{
raycaster.SetActive(true);
controller1.SetActive(true);
controller2.SetActive(false);
}
glassenabled = !glassenabled;
}
}