0 votes

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 doaslide():
if is
onfloor():
can
slide = true
if Input.isactionpressed("moveforward"):
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
in Engine by (20 points)

1 Answer

0 votes

Try to add that line:

slidedirection =  global_transform.basis.xform(slidedirection)
by (1,075 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.