characterbody_physics.gd 325 B

1234567891011121314151617
  1. extends CharacterBody3D
  2. @export var _stop_on_slopes = false
  3. @export var use_snap = false
  4. var _gravity = 20.0
  5. func _physics_process(delta):
  6. if is_on_floor():
  7. floor_snap_length = 0.2
  8. else:
  9. velocity += Vector3.DOWN * _gravity * delta
  10. floor_snap_length = 0.0
  11. floor_stop_on_slope = _stop_on_slopes
  12. move_and_slide()