mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-06 08:19:23 +00:00
[DesktopVRSwitch] - > DesktopXRSwitch
This commit is contained in:
parent
37fcf6ece1
commit
05374459be
21 changed files with 441 additions and 352 deletions
31
DesktopXRSwitch/Patches/CVRPickupObjectTracker.cs
Normal file
31
DesktopXRSwitch/Patches/CVRPickupObjectTracker.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
using ABI.CCK.Components;
|
||||
using UnityEngine;
|
||||
|
||||
//Thanks Ben! I was scared of transpiler so I reworked a bit...
|
||||
|
||||
namespace NAK.Melons.DesktopXRSwitch.Patches;
|
||||
|
||||
public class CVRPickupObjectTracker : MonoBehaviour
|
||||
{
|
||||
public CVRPickupObject pickupObject;
|
||||
public Transform storedGripOrigin;
|
||||
|
||||
void Start()
|
||||
{
|
||||
XRModeSwitchTracker.OnPostXRModeSwitch += PostXRModeSwitch;
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
XRModeSwitchTracker.OnPostXRModeSwitch -= PostXRModeSwitch;
|
||||
}
|
||||
|
||||
public void PostXRModeSwitch(bool isXR, Camera activeCamera)
|
||||
{
|
||||
if (pickupObject != null)
|
||||
{
|
||||
if (pickupObject._controllerRay != null) pickupObject._controllerRay.DropObject(true);
|
||||
(storedGripOrigin, pickupObject.gripOrigin) = (pickupObject.gripOrigin, storedGripOrigin);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue