#Diagonal movement bug. Undesired Zig-Zag effect.
1 messages · Page 1 of 1 (latest)
same outcome.
When you say you used the implementation from the documentation what do you mean? (What was the exact code you used?)
If you move speed outside of the move toward function? It’d be helpful to see more of the code because the issue might not occur here
Very dumb question, but what happens if you hold down all the keys will editing text in notepad? Maybe your keyboard is unable to take multiple inputs at the same time or those specific keys?
`extends CharacterBody2D
@export var speed = 400
func get_input():
var input_direction = Input.get_vector("left", "right", "up", "down")
velocity = input_direction * speed
func _physics_process(delta):
get_input()
move_and_slide()`
To note, instead of making the get_input() function I just inlined the code in the _physics_process()
Maybe it’s your input mapping? Do you have 2 keys assigned to (for example) up?
Im not currently home to check this. Technically I have a mechanical keyboard. I think it can receive multiple inputs at once.
I do have to note that, I checked another project of mine and movement works with the same lines of code. I tried to compare project settings, but nothing.
Not home to check, but unlikely. If say "right" used W and D it would have been noticeable by just moving in one direction.
If the same code works differently in 2 different projects, then it’s probably not the code.