`` if is_on_floor() && input_dir != Vector2.ZERO:
head_bobbing_vector.y = sin(head_bobbing_index)
head_bobbing_vector.x = sin(head_bobbing_index/2)+0.5
eyes.position.y = lerp(eyes.position.y,head_bobbing_vector.y*(head_bobbing_current_intensity/2.0),delta*lerp_speed)
eyes.position.x = lerp(eyes.position.x,head_bobbing_vector.x*head_bobbing_current_intensity,delta*lerp_speed)
else:
eyes.position.y = lerp(eyes.position.y,0.0,delta*lerp_speed)
eyes.position.x = lerp(eyes.position.x,0.0,delta*lerp_speed)
if not is_on_floor():
velocity.y -= gravity * delta
direction = lerp(direction,(transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized(),delta*lerp_speed)
if direction:
velocity.x = direction.x * current_speed
velocity.z = direction.z * current_speed
else:
velocity.x = move_toward(velocity.x, 0, current_speed)
velocity.z = move_toward(velocity.z, 0, current_speed)
move_and_slide()
func _play_footstep_audio():
footstepoutside.pitch_scale = randf_range(.8, 1.2)
footstepoutside.play()
``