I’m extremely new to godot, and I’m trying to make 3d player movement using a tutorial on docs.godotengine.org, and when I use a piece of code, I get the error message seen above. Can anyone help me know what it means
Not sure if you found a solution yet plus you didn’t give much info but its likely a problem with indentation.
If you copy and pasted it directly from the docs it might have pasted into the engine without proper spacing. Try retyping instead (if you did copy and paste) and see if the error still persists.
Otherwise maybe remove the underscore by delta (instead of _delta use delta).
retyped it and removed the underscore, but the error still persisted. Here’s the lines of code that are apart of the line that’s in the question (if that’s the correct term)
if direction != Vector3.ZERO:
target_velocity.x = direction.x * speed
target_velocity.z = direction.z * speed
if not is_on_floor():
target_velocity.y = target_velocity.y - (fall_acceleration * delta)
velocity = target_velocity
move_and_slide()
Solution probably has been found by now but will post the solution in case any else requires it.
This is most probably to do with the fact that the code has been tabbed across at least one space in the declaration of the function, this is often very difficult to spot!
func _input(event:InputEvent) -> void:
if event is InputEventMouseMotion:
mouse_motion = - event.relative * 0.001 #mouse sensitivity
Instead of :
func _input(event:InputEvent) -> void:
if event is InputEventMouseMotion:
mouse_motion = - event.relative * 0.001