Bolt Engine - Best Method for Dashing

Options
What would be the best method for doing a dash using authoritative movement? By dash, I'd like the character to use the playermotor if necessary to lunge forward about 10 units. When I use anything other than cmd.input the beginning and the end of my dash stutters. Any suggestions?

Comments

  • relicright
    edited August 2020
    Options
    Seems like the forums here are dead. In case anyone needs this. I solved this modifying the jump mechanic for dash.

    PlayerMotor.CS
    |||||
    VVVVV


    public struct State
    {
    public Vector3 position;
    public Vector3 velocity;
    public bool isGrounded;
    public int jumpFrames;
    public int dashFrames;
    public bool isRunning;
    }

    [SerializeField]
    public int dashTotalFrame = 60;

    public State Move(bool forward, bool backward, bool left, bool right, bool jump, float yaw, bool isRunning, bool isDashing)
    {
    ...

    if (isDashing && _state.dashFrames == 0)
    {
    _state.dashFrames = (byte)dashTotalFrame;
    }

    if (_state.dashFrames > 0)
    {
    // calculate force
    float force;
    force = (float)_state.dashFrames / (float)dashTotalFrame;
    force = 20 * force;

    Move(transform.forward * force);
    }

    // decrease Dash Frame
    _state.dashFrames = Mathf.Max(0, _state.dashFrames - 1);


    Don't forget to add/update the cmd.result.DashFrames for syncing.
  • azerty
    Options
    love you!!