private void UpdateMovementInput() { float v = Mathf.Round(Input.GetAxis("Vertical")); float h = Mathf.Round(Input.GetAxis("Horizontal")); if (v != oldVerticalAxis || h != oldHorizontalAxis) { inputChanged = true; } // keep the old forward vector until unput has changed Vector3 forward = oldForwardVector; if (inputChanged) { oldForwardVector = forward = thisCamera.transform.forward; inputChanged = false; } forward.y = 0; forward.Normalize(); Vector3 right = new Vector3(forward.z, 0, -forward.x); Vector3 moveDir = (h * right + v * forward).normalized; // if moving if (moveDir.magnitude > 0f) { cameraFollow.CameraSwingControl(); RotateCharacterTowards(forward); } //if(siljaAnimation.enabled) //{ // // apply velocities in animator // //Vector2 moveSpeed = m_movementController.MoveSpeed; // m_characterAnimation.SetForwardSpeed (v); // m_characterAnimation.SetSidewaysSpeed (h); // // // retrieving root motion // moveDir = siljaAnimation.velocity; //} MoveCharacterTowards(moveDir, new Vector2(h, v)); oldVerticalAxis = v; oldHorizontalAxis = h; }