mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-04-19 22:08:34 -04:00
26 lines
562 B
C#
26 lines
562 B
C#
using Sandbox;
|
|
|
|
namespace Menu;
|
|
|
|
[Title( "VR Model Switcher" )]
|
|
public sealed class VRModelSwitcher : Component
|
|
{
|
|
public enum HandSource
|
|
{
|
|
Left,
|
|
Right
|
|
}
|
|
|
|
[Property] public HandSource Source { get; set; }
|
|
|
|
[Property] public GameObject HandTrackedObject { get; set; }
|
|
[Property] public GameObject ControllerObject { get; set; }
|
|
|
|
protected override void OnUpdate()
|
|
{
|
|
var hand = Source == HandSource.Left ? Input.VR.LeftHand : Input.VR.RightHand;
|
|
HandTrackedObject.Enabled = hand.IsHandTracked;
|
|
ControllerObject.Enabled = !hand.IsHandTracked;
|
|
}
|
|
}
|