mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-03 23:09: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_TrackedObject trackedObject;
|
||||||
SteamVR_Behaviour_Pose oldBehaviourPose;
|
SteamVR_Behaviour_Pose oldBehaviourPose;
|
||||||
SteamVR_Action_Pose actionPose = SteamVR_Input.GetAction<SteamVR_Action_Pose>("Pose", false);
|
SteamVR_Action_Pose actionPose;
|
||||||
|
|
||||||
public void Initialize()
|
public void Initialize()
|
||||||
{
|
{
|
||||||
trackedObject = gameObject.AddComponent<SteamVR_TrackedObject>();
|
trackedObject = gameObject.AddComponent<SteamVR_TrackedObject>();
|
||||||
oldBehaviourPose = gameObject.GetComponent<SteamVR_Behaviour_Pose>();
|
oldBehaviourPose = gameObject.GetComponent<SteamVR_Behaviour_Pose>();
|
||||||
oldBehaviourPose.broadcastDeviceChanges = false; //this fucks us
|
oldBehaviourPose.broadcastDeviceChanges = false; //this fucks us
|
||||||
|
oldBehaviourPose.enabled = false;
|
||||||
|
|
||||||
|
actionPose = SteamVR_Input.GetAction<SteamVR_Action_Pose>("Pose", false);
|
||||||
if (actionPose != null) CheckDeviceIndex();
|
if (actionPose != null) CheckDeviceIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnEnable()
|
void OnEnable()
|
||||||
{
|
{
|
||||||
|
// DesktopVRSwitch support
|
||||||
if (actionPose != null) actionPose[inputSource].onDeviceConnectedChanged += OnDeviceConnectedChanged;
|
if (actionPose != null) actionPose[inputSource].onDeviceConnectedChanged += OnDeviceConnectedChanged;
|
||||||
if (oldBehaviourPose != null)
|
if (oldBehaviourPose != null)
|
||||||
oldBehaviourPose.enabled = false;
|
oldBehaviourPose.enabled = false;
|
||||||
|
@ -29,6 +33,7 @@ public class TrackedControllerFixer : MonoBehaviour
|
||||||
|
|
||||||
void OnDisable()
|
void OnDisable()
|
||||||
{
|
{
|
||||||
|
// DesktopVRSwitch support
|
||||||
if (actionPose != null) actionPose[inputSource].onDeviceConnectedChanged -= OnDeviceConnectedChanged;
|
if (actionPose != null) actionPose[inputSource].onDeviceConnectedChanged -= OnDeviceConnectedChanged;
|
||||||
if (oldBehaviourPose != null)
|
if (oldBehaviourPose != null)
|
||||||
oldBehaviourPose.enabled = true;
|
oldBehaviourPose.enabled = true;
|
||||||
|
@ -43,7 +48,7 @@ public class TrackedControllerFixer : MonoBehaviour
|
||||||
|
|
||||||
void CheckDeviceIndex()
|
void CheckDeviceIndex()
|
||||||
{
|
{
|
||||||
if (actionPose[inputSource].active && actionPose[inputSource].deviceIsConnected)
|
if (actionPose[inputSource].deviceIsConnected)
|
||||||
{
|
{
|
||||||
int trackedDeviceIndex = (int)actionPose[inputSource].trackedDeviceIndex;
|
int trackedDeviceIndex = (int)actionPose[inputSource].trackedDeviceIndex;
|
||||||
if (deviceIndex != trackedDeviceIndex)
|
if (deviceIndex != trackedDeviceIndex)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue