mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-03 06:49:22 +00:00
[DesktopVRSwitch] Testing
This commit is contained in:
parent
03514305be
commit
61a45f97bc
30 changed files with 957 additions and 524 deletions
34
DesktopVRSwitch/VRModeTrackers/CVRPickupObjectTracker.cs
Normal file
34
DesktopVRSwitch/VRModeTrackers/CVRPickupObjectTracker.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using ABI.CCK.Components;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NAK.DesktopVRSwitch.VRModeTrackers;
|
||||
|
||||
public class CVRPickupObjectTracker : MonoBehaviour
|
||||
{
|
||||
private CVRPickupObject _pickupObject;
|
||||
private Transform _storedGripOrigin;
|
||||
|
||||
public CVRPickupObjectTracker(CVRPickupObject pickupObject, Transform storedGripOrigin)
|
||||
{
|
||||
this._pickupObject = pickupObject;
|
||||
this._storedGripOrigin = storedGripOrigin;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnPostSwitch(bool intoVR)
|
||||
{
|
||||
if (_pickupObject != null)
|
||||
{
|
||||
// Drop the object if it is being held locally
|
||||
if (_pickupObject._controllerRay != null)
|
||||
_pickupObject._controllerRay.DropObject(true);
|
||||
|
||||
// Swap the grip origins
|
||||
(_storedGripOrigin, _pickupObject.gripOrigin) = (_pickupObject.gripOrigin, _storedGripOrigin);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue