private void UpdateBodyPosition() { UpdateMovementDirection(); ApplyGravity(); MovementDelta = MovementDirection * Time.deltaTime; PlayerCharacterController.Move(MovementDelta); }
private void FixedUpdate() { pic_charContr.Move(MovementDirectionCalc()); if (Input.GetButtonDown("Hide")) { pic_charContr.DoAction(PlayerCharacterController.ActionListElement.HIDE); } else if (Input.GetButtonDown("Interact")) { pic_charContr.DoAction(PlayerCharacterController.ActionListElement.INTERACT); } else if (Input.GetButtonDown("Dash")) { pic_charContr.DoAction(PlayerCharacterController.ActionListElement.DASH); } else if (Input.GetButtonDown("Use")) { pic_charContr.DoAction(PlayerCharacterController.ActionListElement.USE); } }
// Fixed update is called in sync with physics private void Update() { // read inputs moveAxis = Vector2.Lerp(moveAxis, InputManager.Instance.Move.axis, Time.deltaTime * moveSpeed); Vector3 move = Vector3.zero; // calculate move direction to pass to character if (cameraController && useCamera) { // calculate camera relative direction to move: move = moveAxis.y * Vector3.Scale(cameraController.cam.transform.forward, new Vector3(1, 0, 1)).normalized + moveAxis.x * cameraController.cam.transform.right; } else { // we use world-relative directions in the case of no main camera move = moveAxis.y * Vector3.forward + moveAxis.x * Vector3.right; } // pass all parameters to the character control script playerCharacterController.Move(move, false, false); }
private void FixedUpdate() { //Moves depending on the input and reset the jump input. controller.Move(input.direction, input.jump); }