mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 22:39:22 +00:00
[TrackedControllerFix] fix overlay issue
This commit is contained in:
parent
c05213d970
commit
730ff58adc
1 changed files with 7 additions and 2 deletions
|
@ -10,18 +10,22 @@ public class TrackedControllerFixer : MonoBehaviour
|
|||
|
||||
SteamVR_TrackedObject trackedObject;
|
||||
SteamVR_Behaviour_Pose oldBehaviourPose;
|
||||
SteamVR_Action_Pose actionPose = SteamVR_Input.GetAction<SteamVR_Action_Pose>("Pose", false);
|
||||
SteamVR_Action_Pose actionPose;
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
trackedObject = gameObject.AddComponent<SteamVR_TrackedObject>();
|
||||
oldBehaviourPose = gameObject.GetComponent<SteamVR_Behaviour_Pose>();
|
||||
oldBehaviourPose.broadcastDeviceChanges = false; //this fucks us
|
||||
oldBehaviourPose.enabled = false;
|
||||
|
||||
actionPose = SteamVR_Input.GetAction<SteamVR_Action_Pose>("Pose", false);
|
||||
if (actionPose != null) CheckDeviceIndex();
|
||||
}
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
// DesktopVRSwitch support
|
||||
if (actionPose != null) actionPose[inputSource].onDeviceConnectedChanged += OnDeviceConnectedChanged;
|
||||
if (oldBehaviourPose != null)
|
||||
oldBehaviourPose.enabled = false;
|
||||
|
@ -29,6 +33,7 @@ public class TrackedControllerFixer : MonoBehaviour
|
|||
|
||||
void OnDisable()
|
||||
{
|
||||
// DesktopVRSwitch support
|
||||
if (actionPose != null) actionPose[inputSource].onDeviceConnectedChanged -= OnDeviceConnectedChanged;
|
||||
if (oldBehaviourPose != null)
|
||||
oldBehaviourPose.enabled = true;
|
||||
|
@ -43,7 +48,7 @@ public class TrackedControllerFixer : MonoBehaviour
|
|||
|
||||
void CheckDeviceIndex()
|
||||
{
|
||||
if (actionPose[inputSource].active && actionPose[inputSource].deviceIsConnected)
|
||||
if (actionPose[inputSource].deviceIsConnected)
|
||||
{
|
||||
int trackedDeviceIndex = (int)actionPose[inputSource].trackedDeviceIndex;
|
||||
if (deviceIndex != trackedDeviceIndex)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue