I think there are 2 challenges for this mechanic:
- Getting the direction to dash based on aim & user input
- Adding some large impulse to the character so that they move in that direction
I assume that your player already has these two variables: a Vector3 for velocity and a Camera that references the Player's camera. To get the direction, you will need the basis from the Camera's global transform.
#Get the rotation of the head
var aim = camera.get_global_transform().basis;
"aim" has three variables named x, y, and z. These are all Vectors that point up, sideways, and forwards relative to the camera's transform. You can multiply these Vectors with another variable that represents the impulse you want to apply when the player dashes.
var dash_direction = Vector3();
dash_direction += aim.z * Vinput; #Vertical input (ranges from 1 to -1)
dash_direction += aim.x * Hinput; #Horizontal input (ranges from 1 to -1)
dash_direction = dash_direction.normalized();
var dash_vector = dash_direction * dash_speed;
Then add "dash_vector" to your velocity
velocity += dash_vector;