always finding the forward direction

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DanioDevs

Hello im making a slide feature for my game and its working pretty well but i only go in one direction, im trying to have it as you look around and press the slide button you slide in the direction you are facing, here is my script if im doing anything wrong

func _do_a_slide():
if is_on_floor():
can_slide = true
if Input.is_action_pressed(“move_forward”):
slide_direction = Vector3(0, 0, -1).normalized() * 200

if Input.is_action_just_pressed("Slide") and can_slide:
	velocity = slide_direction
	sliding = true
	yield(get_tree().create_timer(0.5), "timeout")
	sliding = false
:bust_in_silhouette: Reply From: juppi

Try to add that line:

slidedirection =  global_transform.basis.xform(slidedirection)