![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | udoubleu |
Hi guys,
I’m reading the templates to learn gd4.
in template charactor body base movement, there is some code here:
var input_dir = Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
var direction=(transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
#var direction = Vector3(input_dir.x ,0,input_dir.y)
print(direction)
if direction:#my question here
velocity.x = direction.x * SPEED
velocity.z = direction.z * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
velocity.z = move_toward(velocity.z, 0, SPEED)
I’m so confusing:
In which condition, the “direction” will turn to FALSE, make the else block run?