0 votes

So I wrote

if Input.isactionpressed("moveforward"):
direction -= head
basis.z
elif Input.isactionpressed("movebackward"):
direction += head
basis.z

if Input.isaction-pressed("moveleft"):
direction -= headbasis.x
elif Input.isactionpressed("moveright"):
direction += head
basis.x

All movements are defined in the input map,
And I have no error warnings at the bottom.
The player will only move right.
What did i do wrong?

asked Jul 3 in Projects by EliLFrench2005 (12 points)

1 Answer

+2 votes

What is the type of direction?
If it's a Vector3, you should do direction.x += headbasis.x & direction.z += headbasis.z instead

answered Jul 3 by frankiezafe (86 points)

Great fix! Thanks much!

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 How to use this Q&A? before posting your first questions.