leaning change?
This commit is contained in:
parent
99d1e59d00
commit
f4ae2f9701
@ -262,6 +262,7 @@ public class FirstPersonController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (toggleLeaning)
|
if (toggleLeaning)
|
||||||
{
|
{
|
||||||
|
// Toggle leaning with a single key press
|
||||||
if (Input.GetKeyDown(leanLeftKey))
|
if (Input.GetKeyDown(leanLeftKey))
|
||||||
{
|
{
|
||||||
isLeaningLeft = !isLeaningLeft;
|
isLeaningLeft = !isLeaningLeft;
|
||||||
@ -275,6 +276,7 @@ public class FirstPersonController : MonoBehaviour
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Continuous leaning while the keys are held down
|
||||||
if (Input.GetKey(leanLeftKey) && !isLeaningRight)
|
if (Input.GetKey(leanLeftKey) && !isLeaningRight)
|
||||||
{
|
{
|
||||||
isLeaningLeft = true;
|
isLeaningLeft = true;
|
||||||
@ -287,8 +289,8 @@ public class FirstPersonController : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply the current leaning angle using the maximum leaning angle
|
// Calculate and apply the current leaning angle using the maximum leaning angle
|
||||||
currentLeaningAngle = Mathf.Clamp(currentLeaningAngle, -maxLeaningAngle, maxLeaningAngle);
|
currentLeaningAngle = isLeaningLeft ? -maxLeaningAngle : isLeaningRight ? maxLeaningAngle : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ApplyFinalMovements()
|
private void ApplyFinalMovements()
|
||||||
|
Loading…
Reference in New Issue
Block a user