17 lines
518 B
GDScript
17 lines
518 B
GDScript
extends State
|
|
|
|
func process_physics(delta: float) -> State:
|
|
if not Main.is_server_or_predicting(subject.player_id, subject.client_prediction): return
|
|
|
|
var target_velocity = Vector3(0, subject.velocity.y, 0)
|
|
subject.velocity = subject.velocity.move_toward(target_velocity, subject.acceleration * delta)
|
|
subject.velocity += Main.gravity_velocity
|
|
subject.move_and_slide()
|
|
|
|
if not subject.is_on_floor(): return %Fall
|
|
|
|
var input_direction = %Input.direction
|
|
if input_direction.length() < 0.05: return
|
|
|
|
return %Run
|