mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-03 14:59:23 +00:00
[TrackedControllerFix] Slight cleanup for consistancy with SmoothRay.
TrackedControllerFix must do stuff in Awake so SmoothRay can handle the SteamVRTrackedObject in Start.
This commit is contained in:
parent
36b1323996
commit
62c5eec71a
2 changed files with 4 additions and 10 deletions
|
@ -10,11 +10,7 @@ class PlayerSetupPatches
|
||||||
[HarmonyPatch(typeof(PlayerSetup), nameof(PlayerSetup.Start))]
|
[HarmonyPatch(typeof(PlayerSetup), nameof(PlayerSetup.Start))]
|
||||||
static void Post_PlayerSetup_Start(ref PlayerSetup __instance)
|
static void Post_PlayerSetup_Start(ref PlayerSetup __instance)
|
||||||
{
|
{
|
||||||
var leftFixer = __instance.vrLeftHandTracker.AddComponent<TrackedControllerFixer>();
|
__instance.vrLeftHandTracker.AddComponent<TrackedControllerFixer>().inputSource = SteamVR_Input_Sources.LeftHand;
|
||||||
leftFixer.inputSource = SteamVR_Input_Sources.LeftHand;
|
__instance.vrRightHandTracker.AddComponent<TrackedControllerFixer>().inputSource = SteamVR_Input_Sources.RightHand;
|
||||||
leftFixer.Initialize();
|
|
||||||
var rightFixer = __instance.vrRightHandTracker.AddComponent<TrackedControllerFixer>();
|
|
||||||
rightFixer.inputSource = SteamVR_Input_Sources.RightHand;
|
|
||||||
rightFixer.Initialize();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,7 +14,7 @@ public class TrackedControllerFixer : MonoBehaviour
|
||||||
|
|
||||||
SteamVR_RenderModel renderModel;
|
SteamVR_RenderModel renderModel;
|
||||||
|
|
||||||
public void Initialize()
|
void Awake()
|
||||||
{
|
{
|
||||||
trackedObject = gameObject.AddComponent<SteamVR_TrackedObject>();
|
trackedObject = gameObject.AddComponent<SteamVR_TrackedObject>();
|
||||||
oldBehaviourPose = gameObject.GetComponent<SteamVR_Behaviour_Pose>();
|
oldBehaviourPose = gameObject.GetComponent<SteamVR_Behaviour_Pose>();
|
||||||
|
@ -46,9 +46,7 @@ public class TrackedControllerFixer : MonoBehaviour
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
if (deviceIndex < 0)
|
if (deviceIndex < 0)
|
||||||
{
|
|
||||||
CheckDeviceIndex();
|
CheckDeviceIndex();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDeviceConnectedChanged(SteamVR_Action_Pose changedAction, SteamVR_Input_Sources changedSource, bool connected)
|
void OnDeviceConnectedChanged(SteamVR_Action_Pose changedAction, SteamVR_Input_Sources changedSource, bool connected)
|
Loading…
Add table
Add a link
Reference in a new issue