void HandleInput() { if (!usedHeavy && !dead) { moveGoal = Vector3.zero; if (Input.GetAxis("L Horizontal Controller " + PlayerID) != 0) { moveGoal.x = Input.GetAxis("L Horizontal Controller " + PlayerID); } if (Input.GetAxis("L Vertical Controller " + PlayerID) != 0) { moveGoal.z = Input.GetAxis("L Vertical Controller " + PlayerID); } Vector3 Pos = transform.position; Pos.z += Input.GetAxis("L Vertical Controller " + PlayerID); Pos.x += Input.GetAxis("L Horizontal Controller " + PlayerID); // print(Pos.x); Debug.DrawLine(transform.position, Pos); Pos -= transform.position; if (Pos.magnitude > 0) { transform.rotation = Quaternion.AngleAxis(((Mathf.Atan2(Pos.z, Pos.x) / Mathf.PI) * -180) + 90, Vector3.up); } moveGoal.z *= Movement.z; moveGoal.x *= Movement.x; // Sprinting, if moving forward if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(PlayerInputL3)) { if (moveGoal.z > 0) { moveGoal.z *= MovementSprintMult; } } animator.SetFloat("Movespeed", moveGoal.magnitude); // Then it is just a matter of using the beautiful SmoothDamp method (much like a spring, but unable to go past the goal) to figure out the best way of making the player move naturally body.MovePosition(Vector3.SmoothDamp(body.position, body.position + moveGoal, ref currentVelocity, 1)); // Action logic // Shoot Vector3 Pos2 = transform.position; Pos2 += new Vector3(Input.GetAxis("R Horizontal Controller " + PlayerID), 0, Input.GetAxis("R Vertical Controller " + PlayerID)); Debug.DrawLine(transform.position, Pos2); Vector3 attackDirction = Pos2 - transform.position; if (Input.GetAxis("R Vertical Controller " + PlayerID) != 0 || Input.GetAxis("R Horizontal Controller " + PlayerID) != 0) { _Instrument.Attack(attackDirction); } if (Input.GetKey(PlayerInputLB)) { _Instrument.Defense(attackDirction); } //left LT if (Input.GetAxis("Controller Triggers Left " + PlayerID) > 0.06) { _Instrument.Utility(attackDirction); } //right RT else if (Input.GetAxis("Controller Triggers Right " + PlayerID) > 0.06) { print(Input.GetAxisRaw("Controller Triggers Right " + PlayerID)); _Instrument.AggroHeavy(attackDirction); animator.SetBool("Heavyattack", true); usedHeavy = true; HeavyWait = animator.GetCurrentAnimatorStateInfo(0).length; } if (Input.GetKey(PlayerInputRB)) { _Instrument.AggroLight(attackDirction); } if (Input.GetKey(PlayerInputA) || Input.GetKey(KeyCode.Space)) { print("A"); } if (Input.GetKey(PlayerInputB)) { print("B"); } } else if (HeavyWait < -100 && usedHeavy) { animator.SetBool("Heavyattack", false); usedHeavy = false; HeavyWait = 0; } else if (usedHeavy) { HeavyWait -= animator.GetCurrentAnimatorStateInfo(0).normalizedTime; print(HeavyWait); } }