Skip to content

Commit

Permalink
fix(coop): sync player rotation with headset (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xenira committed Mar 10, 2024
1 parent ae2ae72 commit 5133d65
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
27 changes: 27 additions & 0 deletions plugin/src/camera/patch/PlayerFirstPersonControllerPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using HarmonyLib;
using UnityEngine;

namespace TechtonicaVR.VRCamera.Patch;

[HarmonyPatch]
class PlayerFirstPersonControllerPatch
{
[HarmonyPatch(typeof(PlayerFirstPersonController), nameof(PlayerFirstPersonController.AutoCrouch))]
[HarmonyPrefix]
static bool AutoCrouchPatch()
{
return true;
}

[HarmonyPrefix]
[HarmonyPatch(typeof(PlayerFirstPersonController), nameof(PlayerFirstPersonController.UpdateThirdPersonView))]
public static bool UpdateThirdPersonView()
{
if (Player.instance.networkedPlayer)
{
Player.instance.networkedPlayer.display.transform.position = Player.instance.transform.position;
Player.instance.networkedPlayer.display.transform.rotation = Quaternion.Euler(0f, VRCameraManager.mainCamera.transform.rotation.eulerAngles.y, 0f);
}
return false;
}
}
14 changes: 0 additions & 14 deletions plugin/src/camera/patch/player_first_person_controller_patch.cs

This file was deleted.

0 comments on commit 5133d65

Please sign in to comment.