Skip to content

Commit

Permalink
Fix positioning bug, nerfed muffling, increased turning speed
Browse files Browse the repository at this point in the history
  • Loading branch information
DaXcess committed Aug 6, 2024
1 parent b80bfe6 commit f6e80a7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ Some bindings are blacklisted from being used, mostly the "touched" bindings on
- XR Origin now has the same parent as the local player
- Reworked a small portion of the 6DOF system to allow 6DOF when parented to other objects
- Resetting height now also resets your rotation if you are in a special interact animation (i.e. terminal, car, enemy kill animation)
- Doubled the base rotation speed on the Smooth Rotation setting

**Removals**:

Expand Down
2 changes: 1 addition & 1 deletion Source/Input/SmoothTurningProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void Update()
if (!shouldExecute)
return;

var totalRotation = (value > 0 ? 90 : -90) * Time.deltaTime * Plugin.Config.SmoothTurnSpeedModifier.Value;
var totalRotation = (value > 0 ? 180 : -180) * Time.deltaTime * Plugin.Config.SmoothTurnSpeedModifier.Value;

offset += totalRotation;
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Physics/Interactions/Face.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class Face : MonoBehaviour, VRInteractable
];

private GrabbableObject heldItem;
private bool isInteracting = false;
private bool isInteracting;

private Coroutine stopInteractingCoroutine;

Expand Down Expand Up @@ -59,7 +59,7 @@ public void OnColliderEnter(VRInteractor _)
isInteracting = true;
heldItem = item;

heldItem.UseItemOnClient(true);
heldItem.UseItemOnClient();
}

public void OnColliderExit(VRInteractor _)
Expand Down
17 changes: 11 additions & 6 deletions Source/Physics/Interactions/Muffler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,17 @@ public class Muffler : MonoBehaviour, VRInteractable

public InteractableFlags Flags => InteractableFlags.BothHands;
public bool Muffled { get; private set; }

private void Update()
{
if (Muffled)
counter = Mathf.Min(counter + Time.deltaTime * 2, MAX_COUNTER);
else
counter = Mathf.Max(counter - Time.deltaTime, 0);
counter = Muffled
? Mathf.Min(counter + Time.deltaTime * 2, MAX_COUNTER)
: Mathf.Max(counter - Time.deltaTime, 0);

// Disable muffle if we picked up a two-handed item while muffled
if (Muffled && VRSession.Instance.LocalPlayer.PlayerController.currentlyHeldObjectServer is { } heldObject &&
heldObject.itemProperties.twoHanded)
Muffled = false;

VRSession.Instance.VolumeManager.Muffle(counter);
}
Expand Down Expand Up @@ -79,7 +83,8 @@ private IEnumerator delayedStopMuffle(VRInteractor interactor)
{
yield return new WaitForSeconds(0.5f);

interactor.Vibrate(0.2f, 0.1f);
if (Muffled)
interactor.Vibrate(0.2f, 0.1f);

Muffled = false;
DNet.SetMuffled(false);
Expand Down
9 changes: 3 additions & 6 deletions Source/Player/VRPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,10 @@ PlayerController.currentTriggerInAnimationWith is not null &&

TurningProvider.SetOffset(offset);
specialAnimationPositionOffset = Quaternion.Euler(0, offset, 0) *
(
new Vector3(mainCamera.transform.localPosition.x, 0,
mainCamera.transform.localPosition.z) * -SCALE_FACTOR)
(new Vector3(mainCamera.transform.localPosition.x, 0,
mainCamera.transform.localPosition.z) * -SCALE_FACTOR)
.Divide(transform.parent.localScale);

isSprinting = false;
}

Expand All @@ -414,9 +414,6 @@ PlayerController.currentTriggerInAnimationWith is not null &&
var movementAccounted = rotationOffset * movement;
var cameraPosAccounted = rotationOffset * new Vector3(mainCamera.transform.localPosition.x, 0, mainCamera.transform.localPosition.z);

if (!wasInSpecialAnimation && PlayerController.inSpecialInteractAnimation)
specialAnimationPositionOffset = new Vector3(-cameraPosAccounted.x * SCALE_FACTOR, 0, -cameraPosAccounted.z * SCALE_FACTOR);

wasInSpecialAnimation = PlayerController.inSpecialInteractAnimation;
wasInEnemyAnimation = PlayerController.inAnimationWithEnemy is not null;

Expand Down

0 comments on commit f6e80a7

Please sign in to comment.