Can't get animations to base themselves off of local rotation

4.5.stable

I am trying to make a character controller and I can’t get my character’s animations to rotate correctly. when i am facing a certain direction everything is fine but when i turn right or left the moving forwards will play strafe left or right. I did follow a tutorial i followed previously to set up a statemachien witha animation tree but i didnt remeber how

func get_move_input(delta):
	var vy = velocity.y
	velocity.y = 0
	var input = Input.get_vector("Left", "Right", "Forward", "Back")
	var dir = Vector3(input.x, 0, input.y).rotated(Vector3.UP, spring_arm.rotation.y)
	velocity = lerp(velocity, dir * speed, acceleration * delta)
	var vl = velocity * rotation.normalized() # this is my suspect

	anim_tree.set("parameters/IWR/blend_position", Vector2(vl.x, -vl.z) / speed)
	velocity.y = vy

model is the player

and here is my scene tree

What is vl supposed to represent?

im using another account rn but it assigns the blend space 2d coordinates in my state machine for idle walk run (IWR) and so with what its at right now when i face toward - z i everything works but if i turn right then move left, i stead of strafing left like it should it play move forward.
To put it simply my animations are locked to the global coordinates instead of locally changing depending on where the player is facing (Sry for the poor typing)

Ok i think it stands for velocity local