public void FixedUpdate() { if (GameAPI.instance.isPaused) { return; } playerCamera.transform.UpdateRenderSettings(); if (characterController == null) { return; } var x = Input.GetAxisRaw("Horizontal"); var z = Input.GetAxisRaw("Vertical"); var isRunning = !Input.GetButton("Run"); var isCrouching = Input.GetButton("Crouch"); var isUsing = Input.GetButtonDown("Use"); isStrafing = false; // TEST ONLY if (Input.GetKeyDown(KeyCode.P)) { test_aim = !test_aim; } if (isUsing) { UseItem(); } if (!characterController.isRolling) { if (isCrouching) { characterController.ToggleCrouch(true); } else { characterController.ToggleCrouch(false); } if (isRunning && !isCrouching) { characterController.movementMode = MovementMode.Run; } else if (!isCrouching) { characterController.movementMode = MovementMode.Walk; } if (leftButton.IsDoublePressed()) { characterController.RollLeft(); } if (rightButton.IsDoublePressed()) { characterController.RollRight(); } //Check even here due to code bellow :/ if (characterController.isRolling) { return; } if (z > 0f) { characterController.MoveForward(); } else if (z < 0f) { characterController.MoveBackward(); } if (x > 0f) { characterController.MoveRight(); isStrafing = true; } else if (x < 0f) { characterController.MoveLeft(); isStrafing = true; } } characterController.Update(); UpdateCameraMovement(); // TEST ONLY if (test_aim && !characterController.IsRolling()) { var look = playerCamera.transform.position; var back1 = playerPawn.transform.Find("base/back1").transform; look.y += test_offset; back1.LookAt(look, back1.up); back1.Rotate(new Vector3(0f, 180f, 0f), Space.Self); characterController.stanceMode = AnimationStanceMode.Pistol; } }