New to godot trying to rotate a character after my camera

Hi. Im new to godot and im trying to apply what i know in C# to godot, there isnt alot of resources out there for C#, but ive managed to try to translate some gdscript to C#. I have in my code a couple of tutorials mixed in together. And now i try to rotate my Player after which way the camera is looking. Im trying to use a Basis from one of my pivots in my scene and multiply my input. But it doesnt seem to work like i want it to… Here is my process and mouseInput methods. Thanks

(A little edit. My character seems to be walking to the left of the camera when im standing still and rotating the camera then pressing W. So when i spin 180 degrees it works)

(Another edit. The only thing that isnt working is the rotation. When i comment out the rotation code, the character follows my mouse movement. So i need to figure out how to rotate my character towards where the character is heading. But that also seems to be really hard. I cant seem to figure it out…)

public override void _Process(double delta)
{

	if(Input.IsActionJustPressed("ui_cancel")){
		Input.MouseMode = Input.MouseModeEnum.Visible;
	}

	Vector3 velocity = Velocity;

	Vector2 input = Input.GetVector("left", "right", "up", "down");

	Basis camBasis = twistPivot.Basis;
	
	Vector3 direction = camBasis * new Vector3(input.X, 0, input.Y);


	velocity.X = direction.X * SPEED;
	velocity.Z = direction.Z * SPEED;

	if(!IsOnFloor()){
		velocity.Y -= GRAVITY * (float)delta;
	}
	else{
		if(Input.IsActionJustPressed("jump")){
			velocity.Y = JUMPVELOCITY;
		}
	}
	Velocity = velocity;


	if(new Vector2(Velocity.X, Velocity.Y).Length() > 0){
		rotation_angle = new Vector2(Velocity.Z, Velocity.X).Angle();
		Vector3 rot = Rotation;

		rot.Y = (float)Mathf.LerpAngle(rot.Y, rotation_angle, 10 * delta);

		Rotation = rot;
	}

	twistPivot.RotateY(twist_input);
	pitchPivot.RotateX(pitch_input);
	pitchPivot.Rotation = new Vector3(Mathf.Clamp(pitchPivot.Rotation.X, Mathf.DegToRad(-30), Mathf.DegToRad(30)), 0, 0);

	twist_input = 0.0f;
	pitch_input = 0.0f;

	MoveAndSlide();
	Animate();

}

public override void _UnhandledInput(InputEvent @event){
if (@event is InputEventMouseMotion eventKey)
    if(Input.MouseMode == Input.MouseModeEnum.Captured){
		twist_input = - eventKey.Relative.X * SENSITIVITY;
		pitch_input = - eventKey.Relative.Y * SENSITIVITY;
	}