I am making a multiplayer game, where a main mechanic is the ability to dash towards the mouse. After quite a bit of pain, I have worked out all of the inputs. Now here’s the issue: I don’t know how to actually make the player dash. I have the button to start the dash, the timer for the dash, and the mouse/controller input set up. I know how to use things like “rb.velocity” or “rb.AddForce” But, I don’t know how to take my input’s Vector2 and actually apply it to the dash ability, to control the direction. Does anyone know how I might do this? Here’s the code I currently have:
public void Dash(InputAction.CallbackContext context)
{
// dash when dash button is pressed (dash button and the timer are handled in another void)
if (startDash == true)
{
Vector2 DashAim = context.ReadValue<Vector2>();
//dash
startDash = false;
}
}