Player walk animations

-Added walk animation
-Added strafe animation
-Added animation blending for strafe and walk
-Added method that controls animation parameters based on movement speed

-smol canvas fix
This commit is contained in:
juliuse98
2021-11-28 18:54:24 +01:00
parent 20080a4dd5
commit a4fb6b9f33
14 changed files with 2576 additions and 220 deletions

View File

@@ -75,6 +75,7 @@ public class ProcedualAnimationController : NetworkBehaviour
[SerializeField] float maxRecoil = 0.1f;
private Animator gunAnimator;
[SerializeField] private Animator playerAnimator;
Vector3 startPos, startRot;
float recoilOffset = 0f;
@@ -93,7 +94,11 @@ public class ProcedualAnimationController : NetworkBehaviour
Vector3[] positionMod = new Vector3[3];
public Quaternion[] rotationMod = new Quaternion[3];
public void walkAnimation()
{
playerAnimator.SetFloat("x", playerController.localVelocity.x / playerController.currentMaxSpeed);
playerAnimator.SetFloat("y", playerController.localVelocity.z / playerController.currentMaxSpeed);
}
public void OnSwitchWeapon(GameObject currentWeapon)
{
if (isLocalPlayer) {
@@ -135,6 +140,8 @@ public class ProcedualAnimationController : NetworkBehaviour
{
if (isLocalPlayer)
{
walkAnimation();
CmdAim(Input.GetButton("Aim"));
}
/*-----Aiming-----*/