Skip to content

Commit

Permalink
the height fix in question:
Browse files Browse the repository at this point in the history
  • Loading branch information
whateverusername0 committed Apr 19, 2023
1 parent bb3f361 commit b07d8b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions VRTRAKILL/VRTRAKILL/VRPlayer/Movement/VRPlayerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ private void Start()
CC = GetComponent<CapsuleCollider>();
}

private void Update()
private void FixedUpdate()
{
// Update player's height
float DistanceFromFloor = Vector3.Dot(Vars.VRCameraContainer.transform.localPosition, Vector3.up);
CC.height = Mathf.Max(CC.radius, DistanceFromFloor);

if (NewMovement.Instance.sliding) CC.height = Mathf.Max(CC.radius, DistanceFromFloor - 0.35f);
else CC.height = Mathf.Max(CC.radius, DistanceFromFloor);

CC.center = Vars.VRCameraContainer.transform.localPosition - 0.5f * DistanceFromFloor * Vector3.up;
}
}
}
}
2 changes: 1 addition & 1 deletion VRTRAKILL/VRTRAKILL/VRPlayer/Patches/PlayerP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Plugin.VRTRAKILL.VRPlayer.Patches

[HarmonyPatch(typeof(NewMovement))] internal class PlayerP
{
// before the patch the player was like TWICE as big and was TWICE as faster
// before the patch the player was like TWICE as tall, now it's height is controlled by VRPlayerController
[HarmonyPrefix] [HarmonyPatch(nameof(NewMovement.Start))] static void SetupVRController(NewMovement __instance)
{
__instance.gameObject.AddComponent<Movement.VRPlayerController>();
Expand Down

0 comments on commit b07d8b7

Please sign in to comment.