class_name PlayerShipController extends ShipController # Drives a Ship from the local player's input actions (see project.godot # [input] and FLIGHT_MANUAL.md). var _action := ShipAction.new() func get_action() -> ShipAction: # Full overwrite per axis (not +=/-=): _action is reused across ticks, so # fields must not depend on starting from a fresh Vector3.ZERO each call. # Forward/Backward thrust (main engines) _action.thrust.z = (1.0 if Input.is_action_pressed("move_forward") else 0.0) \ - (1.0 if Input.is_action_pressed("move_back") else 0.0) # Strafe thrusters (left/right) _action.thrust.x = (1.0 if Input.is_action_pressed("move_right") else 0.0) \ - (1.0 if Input.is_action_pressed("move_left") else 0.0) # Vertical thrusters (up/down) _action.thrust.y = (1.0 if Input.is_action_pressed("move_up") else 0.0) \ - (1.0 if Input.is_action_pressed("move_down") else 0.0) # Yaw (turn left/right around Y axis) _action.rotation.y = (1.0 if Input.is_action_pressed("turn_left") else 0.0) \ - (1.0 if Input.is_action_pressed("turn_right") else 0.0) # Pitch (nose up/down around X axis) _action.rotation.x = (1.0 if Input.is_action_pressed("pitch_down") else 0.0) \ - (1.0 if Input.is_action_pressed("pitch_up") else 0.0) # Roll (bank left/right around Z axis) _action.rotation.z = (1.0 if Input.is_action_pressed("roll_left") else 0.0) \ - (1.0 if Input.is_action_pressed("roll_right") else 0.0) _action.turbo = Input.is_action_pressed("turbo") return _action