diff --git a/tutorials/physics/physics_introduction.rst b/tutorials/physics/physics_introduction.rst index ec8fa8533..eeb791d5b 100644 --- a/tutorials/physics/physics_introduction.rst +++ b/tutorials/physics/physics_introduction.rst @@ -263,15 +263,15 @@ For example, here is the code for an "Asteroids" style spaceship: func _integrate_forces(state): if Input.is_action_pressed("ui_up"): - applied_force = thrust.rotated(rotation) + state.apply_force(thrust.rotated(rotation)) else: - applied_force = Vector2() - var rotation_dir = 0 + state.apply_force(Vector2()) + var rotation_direction = 0 if Input.is_action_pressed("ui_right"): - rotation_dir += 1 + rotation_direction += 1 if Input.is_action_pressed("ui_left"): - rotation_dir -= 1 - applied_torque = rotation_dir * torque + rotation_direction -= 1 + state.apply_torque(rotation_direction * torque) .. code-tab:: csharp