Rework controls display to properties
This commit is contained in:
parent
821072eae5
commit
4be36eb39e
2 changed files with 22 additions and 25 deletions
|
|
@ -1,6 +1,26 @@
|
|||
@tool
|
||||
class_name Controls
|
||||
extends Node2D
|
||||
## Recreate the controls page from lidia Python package
|
||||
|
||||
const AXIS_SIZE: float = 326
|
||||
|
||||
@export var controls: Vector4:
|
||||
set(value):
|
||||
controls = value
|
||||
current_cyclic.position.x = AXIS_SIZE / 2.0 * controls.x
|
||||
current_cyclic.position.y = AXIS_SIZE / 2.0 * controls.y
|
||||
current_pedals.position.x = AXIS_SIZE / 2.0 * controls.z
|
||||
current_collective.position.y = -AXIS_SIZE * controls.w
|
||||
|
||||
@export var trim: Vector4:
|
||||
set(value):
|
||||
trim = value
|
||||
trim_lateral.position.x = AXIS_SIZE / 2.0 * trim.x
|
||||
trim_longitudinal.position.y = AXIS_SIZE / 2.0 * trim.y
|
||||
trim_pedals.position.x = AXIS_SIZE / 2.0 * trim.z
|
||||
trim_collective.position.y = -AXIS_SIZE * trim.w
|
||||
|
||||
@onready var trim_longitudinal: Node2D = $CyclicOrigin/TrimLongitudinal
|
||||
@onready var trim_lateral: Node2D = $CyclicOrigin/TrimLateral
|
||||
@onready var current_cyclic: Node2D = $CyclicOrigin/CurrentCyclic
|
||||
|
|
@ -8,26 +28,3 @@ extends Node2D
|
|||
@onready var current_collective: Node2D = $CollectiveOrigin/CurrentCollective
|
||||
@onready var trim_pedals: Node2D = $PedalsOrigin/TrimPedals
|
||||
@onready var current_pedals: Node2D = $PedalsOrigin/CurrentPedals
|
||||
|
||||
const AXIS_SIZE: float = 326
|
||||
|
||||
func set_controls(current: Vector4):
|
||||
set_cyclic(Vector2(current.x, current.y))
|
||||
set_collective(current.w)
|
||||
set_pedals(current.z)
|
||||
|
||||
func set_cyclic(current: Vector2):
|
||||
current_cyclic.position.x = AXIS_SIZE / 2.0 * current.x
|
||||
current_cyclic.position.y = AXIS_SIZE / 2.0 * current.y
|
||||
|
||||
func set_collective(current: float):
|
||||
current_collective.position.y = -AXIS_SIZE * current
|
||||
|
||||
func set_pedals(current: float):
|
||||
current_pedals.position.x = AXIS_SIZE / 2.0 * current
|
||||
|
||||
func set_trim(trim: Vector4):
|
||||
trim_lateral.position.x = AXIS_SIZE / 2.0 * trim.x
|
||||
trim_longitudinal.position.y = AXIS_SIZE / 2.0 * trim.y
|
||||
trim_pedals.position.x = AXIS_SIZE / 2.0 * trim.z
|
||||
trim_collective.position.y = -AXIS_SIZE * trim.w
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue