Player Movement
Player Movement
using UnityEngine;
[Space(10)]
public LayerMask whatIsGround;
public LayerMask whatIsWallrunnable;
[Header("MovementSettings")]
public float sensitivity = 10000f;
public float moveSpeed = 4500f;
[Header("Audio Settings")]
public AudioClip runningSound;
public AudioClip slidingSound;
private AudioSource runningAudioSource;
private AudioSource slidingAudioSource;
[Header("Vault Settings")]
public float vaultDistance = 1f;
public float vaultHeight = 1.5f; // Height to which player will teleport
private bool isVaulting = false;
runningAudioSource = gameObject.AddComponent<AudioSource>();
runningAudioSource.loop = true; // Ensure the sound loops while running
slidingAudioSource = gameObject.AddComponent<AudioSource>();
slidingAudioSource.loop = true; // Ensure the sound loops while sliding
}
// CounterMovement method
CounterMovement(x, y, mag);
FindWallRunRotation();
actualWallRotation = Mathf.SmoothDamp(actualWallRotation, wallRunRotation, ref
wallRotationVel, 0.2f);
playerCam.transform.localRotation = Quaternion.Euler(xRotation, desiredX,
actualWallRotation);
orientation.transform.localRotation = Quaternion.Euler(0f, desiredX, 0f);
}