mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-03 14:59:23 +00:00
i have no fucking clue
This commit is contained in:
parent
730ff58adc
commit
f783fe612d
21 changed files with 496 additions and 49 deletions
|
@ -6,11 +6,13 @@ namespace NAK.TrackedControllerFix;
|
|||
public class TrackedControllerFixer : MonoBehaviour
|
||||
{
|
||||
public SteamVR_Input_Sources inputSource;
|
||||
public int deviceIndex;
|
||||
public int deviceIndex = -1;
|
||||
|
||||
SteamVR_TrackedObject trackedObject;
|
||||
SteamVR_Behaviour_Pose oldBehaviourPose;
|
||||
SteamVR_Action_Pose actionPose;
|
||||
|
||||
SteamVR_RenderModel renderModel;
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
|
@ -19,6 +21,8 @@ public class TrackedControllerFixer : MonoBehaviour
|
|||
oldBehaviourPose.broadcastDeviceChanges = false; //this fucks us
|
||||
oldBehaviourPose.enabled = false;
|
||||
|
||||
renderModel = gameObject.GetComponentInChildren<SteamVR_RenderModel>();
|
||||
|
||||
actionPose = SteamVR_Input.GetAction<SteamVR_Action_Pose>("Pose", false);
|
||||
if (actionPose != null) CheckDeviceIndex();
|
||||
}
|
||||
|
@ -39,6 +43,14 @@ public class TrackedControllerFixer : MonoBehaviour
|
|||
oldBehaviourPose.enabled = true;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (deviceIndex < 0)
|
||||
{
|
||||
CheckDeviceIndex();
|
||||
}
|
||||
}
|
||||
|
||||
void OnDeviceConnectedChanged(SteamVR_Action_Pose changedAction, SteamVR_Input_Sources changedSource, bool connected)
|
||||
{
|
||||
if (actionPose != changedAction) actionPose = changedAction;
|
||||
|
@ -54,7 +66,8 @@ public class TrackedControllerFixer : MonoBehaviour
|
|||
if (deviceIndex != trackedDeviceIndex)
|
||||
{
|
||||
deviceIndex = trackedDeviceIndex;
|
||||
trackedObject.SetDeviceIndex(deviceIndex);
|
||||
trackedObject?.SetDeviceIndex(deviceIndex);
|
||||
renderModel?.SetDeviceIndex(deviceIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue