mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-03 14:59:23 +00:00
broken
This commit is contained in:
parent
26441f8b1e
commit
c7b16abd4f
27 changed files with 591 additions and 91 deletions
|
@ -12,17 +12,17 @@ public class MovementSystemTracker : MonoBehaviour
|
|||
void Start()
|
||||
{
|
||||
movementSystem = GetComponent<MovementSystem>();
|
||||
VRModeSwitchTracker.OnPostVRModeSwitch += PreVRModeSwitch;
|
||||
VRModeSwitchTracker.OnPreVRModeSwitch += PreVRModeSwitch;
|
||||
VRModeSwitchTracker.OnPostVRModeSwitch += PostVRModeSwitch;
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
VRModeSwitchTracker.OnPostVRModeSwitch -= PreVRModeSwitch;
|
||||
VRModeSwitchTracker.OnPreVRModeSwitch -= PreVRModeSwitch;
|
||||
VRModeSwitchTracker.OnPostVRModeSwitch -= PostVRModeSwitch;
|
||||
}
|
||||
|
||||
public void PreVRModeSwitch(bool isVR, Camera activeCamera)
|
||||
public void PreVRModeSwitch(bool enableVR, Camera activeCamera)
|
||||
{
|
||||
//correct rotationPivot y position, so we dont teleport up/down
|
||||
Vector3 position = movementSystem.rotationPivot.transform.position;
|
||||
|
@ -34,15 +34,21 @@ public class MovementSystemTracker : MonoBehaviour
|
|||
|
||||
//I correct for this in lazy way, but i use rotationPivot instead of avatar root,
|
||||
//so the user can still switch even if avatar is null (if it failed to load for example).
|
||||
|
||||
movementSystem.ChangeCrouch(false);
|
||||
movementSystem.ChangeProne(false);
|
||||
}
|
||||
|
||||
public void PostVRModeSwitch(bool isVR, Camera activeCamera)
|
||||
public void PostVRModeSwitch(bool enableVR, Camera activeCamera)
|
||||
{
|
||||
//immediatly update camera to new camera transform
|
||||
movementSystem.rotationPivot = activeCamera.transform;
|
||||
//lazy way of correcting Desktop & VR offset issue (game does the maths)
|
||||
movementSystem.TeleportToPosRot(preSwitchWorldPosition, preSwitchWorldRotation, false);
|
||||
//recenter desktop collision to player object
|
||||
if (!isVR) movementSystem.UpdateColliderCenter(movementSystem.transform.position);
|
||||
if (!enableVR) movementSystem.UpdateColliderCenter(movementSystem.transform.position);
|
||||
|
||||
movementSystem.ChangeCrouch(false);
|
||||
movementSystem.ChangeProne(false);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue