Looking-Glass/Assets/playerstuff/SwapLeftHandToGlass.cs

29 lines
819 B
C#
Raw Normal View History

2024-02-02 12:54:47 +01:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
2024-02-07 20:26:35 +01:00
// 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
2024-02-02 12:54:47 +01:00
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;
}
}