0 votes

I'm new to GDScript, and I want to know if there is any way to move the player locally instead of globally.

Now, this might be not the thing that I want to do,
Let me explain what I want to achieve;
I can turn my player right or left (you can imagine this as a vehicle) and when I move forward the player moves forward. Now the issue is it does not move in the direction that it's looking towards!

How can I do that?

Godot version 3.4.3
in Engine by (60 points)

this ?
look in the direction it's moving

var velo = Vector3.ZERO

if velo != Vector3.ZERO:
    look_at(translation - velo,Vector3.UP)

and
move in the direction it is looking

func _process(delta):
    var dir = Vector3.ZERO
    if Input.is_action_pressed("ui_up"):
        dir = transform.basis.z * 50 

or
https://www.youtube.com/watch?v=UpF7wm0186Q

Please log in or register to answer this question.

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.