Recreate lidia controls with Node2D
This commit is contained in:
parent
f3d38c7569
commit
821072eae5
23 changed files with 433 additions and 35 deletions
BIN
project/instruments/controls-background.png
(Stored with Git LFS)
Normal file
BIN
project/instruments/controls-background.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
project/instruments/controls-background.png.import
Normal file
34
project/instruments/controls-background.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b0oeokas7mq4q"
|
||||
path="res://.godot/imported/controls-background.png-626db610a70b7b467da1123d55529d5c.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://instruments/controls-background.png"
|
||||
dest_files=["res://.godot/imported/controls-background.png-626db610a70b7b467da1123d55529d5c.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
project/instruments/controls-ref.png
(Stored with Git LFS)
Normal file
BIN
project/instruments/controls-ref.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
project/instruments/controls-ref.png.import
Normal file
34
project/instruments/controls-ref.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c5bcvbphgg1nk"
|
||||
path="res://.godot/imported/controls-ref.png-ed1b9d803223424fa895ad19151b7e9f.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://instruments/controls-ref.png"
|
||||
dest_files=["res://.godot/imported/controls-ref.png-ed1b9d803223424fa895ad19151b7e9f.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
33
project/instruments/controls.gd
Normal file
33
project/instruments/controls.gd
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
extends Node2D
|
||||
## Recreate the controls page from lidia Python package
|
||||
|
||||
@onready var trim_longitudinal: Node2D = $CyclicOrigin/TrimLongitudinal
|
||||
@onready var trim_lateral: Node2D = $CyclicOrigin/TrimLateral
|
||||
@onready var current_cyclic: Node2D = $CyclicOrigin/CurrentCyclic
|
||||
@onready var trim_collective: Node2D = $CollectiveOrigin/TrimCollective
|
||||
@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
|
||||
1
project/instruments/controls.gd.uid
Normal file
1
project/instruments/controls.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://ds6f8cur05ka0
|
||||
54
project/instruments/controls.tscn
Normal file
54
project/instruments/controls.tscn
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://bgkpwebqksth5"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ds6f8cur05ka0" path="res://instruments/controls.gd" id="1_g7kvs"]
|
||||
[ext_resource type="Texture2D" uid="uid://b0oeokas7mq4q" path="res://instruments/controls-background.png" id="2_wbvwt"]
|
||||
[ext_resource type="Texture2D" uid="uid://c561m3pvc0kop" path="res://instruments/trim-long.png" id="3_37ekc"]
|
||||
[ext_resource type="Texture2D" uid="uid://wdqnlguxmi2a" path="res://instruments/current-dot.png" id="4_4updv"]
|
||||
[ext_resource type="Texture2D" uid="uid://dytpn8rcdimr" path="res://instruments/trim-short.png" id="5_ni3tk"]
|
||||
[ext_resource type="Texture2D" uid="uid://dkda6ju5daocf" path="res://instruments/current-arrow.png" id="6_mfntf"]
|
||||
|
||||
[node name="Controls" type="Node2D"]
|
||||
script = ExtResource("1_g7kvs")
|
||||
|
||||
[node name="Background" type="Sprite2D" parent="."]
|
||||
position = Vector2(256, 256)
|
||||
texture = ExtResource("2_wbvwt")
|
||||
|
||||
[node name="CyclicOrigin" type="Node2D" parent="."]
|
||||
position = Vector2(309, 189)
|
||||
|
||||
[node name="TrimLongitudinal" type="Sprite2D" parent="CyclicOrigin"]
|
||||
position = Vector2(10, 0)
|
||||
texture = ExtResource("3_37ekc")
|
||||
|
||||
[node name="TrimLateral" type="Sprite2D" parent="CyclicOrigin"]
|
||||
position = Vector2(0, 10)
|
||||
rotation = 1.5708
|
||||
texture = ExtResource("3_37ekc")
|
||||
|
||||
[node name="CurrentCyclic" type="Sprite2D" parent="CyclicOrigin"]
|
||||
texture = ExtResource("4_4updv")
|
||||
|
||||
[node name="CollectiveOrigin" type="Node2D" parent="."]
|
||||
position = Vector2(72.5, 352)
|
||||
|
||||
[node name="TrimCollective" type="Sprite2D" parent="CollectiveOrigin"]
|
||||
position = Vector2(-10.5, 0)
|
||||
texture = ExtResource("5_ni3tk")
|
||||
|
||||
[node name="CurrentCollective" type="Sprite2D" parent="CollectiveOrigin"]
|
||||
position = Vector2(20.5, 0)
|
||||
texture = ExtResource("6_mfntf")
|
||||
|
||||
[node name="PedalsOrigin" type="Node2D" parent="."]
|
||||
position = Vector2(309, 425.5)
|
||||
|
||||
[node name="TrimPedals" type="Sprite2D" parent="PedalsOrigin"]
|
||||
position = Vector2(0, 10.5)
|
||||
rotation = -1.5708
|
||||
texture = ExtResource("5_ni3tk")
|
||||
|
||||
[node name="CurrentPedals" type="Sprite2D" parent="PedalsOrigin"]
|
||||
position = Vector2(0, -21.5)
|
||||
rotation = -1.5708
|
||||
texture = ExtResource("6_mfntf")
|
||||
BIN
project/instruments/current-arrow.png
(Stored with Git LFS)
Normal file
BIN
project/instruments/current-arrow.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
project/instruments/current-arrow.png.import
Normal file
34
project/instruments/current-arrow.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dkda6ju5daocf"
|
||||
path="res://.godot/imported/current-arrow.png-8e092288abc9ec8d31cbc8f708a9c800.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://instruments/current-arrow.png"
|
||||
dest_files=["res://.godot/imported/current-arrow.png-8e092288abc9ec8d31cbc8f708a9c800.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
project/instruments/current-dot.png
(Stored with Git LFS)
Normal file
BIN
project/instruments/current-dot.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
project/instruments/current-dot.png.import
Normal file
34
project/instruments/current-dot.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://wdqnlguxmi2a"
|
||||
path="res://.godot/imported/current-dot.png-789da8759af9526ce5f8705121a1077d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://instruments/current-dot.png"
|
||||
dest_files=["res://.godot/imported/current-dot.png-789da8759af9526ce5f8705121a1077d.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
47
project/instruments/instruments.tscn
Normal file
47
project/instruments/instruments.tscn
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://cis4s43ubuynp"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://01bmfj4wthwg" path="res://instruments.gd" id="1_wlkep"]
|
||||
[ext_resource type="PackedScene" uid="uid://bgkpwebqksth5" path="res://instruments/controls.tscn" id="2_372d7"]
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_nowl7"]
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_8lpkn"]
|
||||
viewport_path = NodePath("SubViewport")
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_h5at3"]
|
||||
resource_local_to_scene = true
|
||||
albedo_texture = SubResource("ViewportTexture_8lpkn")
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_h5at3"]
|
||||
viewport_path = NodePath("SubViewport2")
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_8lpkn"]
|
||||
resource_local_to_scene = true
|
||||
albedo_texture = SubResource("ViewportTexture_h5at3")
|
||||
|
||||
[node name="Instruments" type="Node3D"]
|
||||
script = ExtResource("1_wlkep")
|
||||
lidia_hostname = "192.168.1.2"
|
||||
|
||||
[node name="SubViewport" type="SubViewport" parent="."]
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="SubViewport"]
|
||||
offset_right = 512.0
|
||||
offset_bottom = 512.0
|
||||
expand_mode = 5
|
||||
|
||||
[node name="Quad" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(0.8, 0, 0, 0, 0.8, 0, 0, 0, 0.8, -0.35, 0, 0)
|
||||
mesh = SubResource("QuadMesh_nowl7")
|
||||
surface_material_override/0 = SubResource("StandardMaterial3D_h5at3")
|
||||
|
||||
[node name="SubViewport2" type="SubViewport" parent="."]
|
||||
|
||||
[node name="Controls" parent="SubViewport2" instance=ExtResource("2_372d7")]
|
||||
|
||||
[node name="Quad2" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(0.6, 0, 0, 0, 0.6, 0, 0, 0, 0.6, 0.425, 0, 0)
|
||||
mesh = SubResource("QuadMesh_nowl7")
|
||||
surface_material_override/0 = SubResource("StandardMaterial3D_8lpkn")
|
||||
|
||||
[node name="CEF" type="GDCef" parent="."]
|
||||
BIN
project/instruments/pfd-ref.png
(Stored with Git LFS)
Normal file
BIN
project/instruments/pfd-ref.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
project/instruments/pfd-ref.png.import
Normal file
34
project/instruments/pfd-ref.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://toojp8r3424r"
|
||||
path="res://.godot/imported/pfd-ref.png-18e0fc5274406321f68279cb4defcf25.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://instruments/pfd-ref.png"
|
||||
dest_files=["res://.godot/imported/pfd-ref.png-18e0fc5274406321f68279cb4defcf25.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
project/instruments/trim-long.png
(Stored with Git LFS)
Normal file
BIN
project/instruments/trim-long.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
project/instruments/trim-long.png.import
Normal file
34
project/instruments/trim-long.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c561m3pvc0kop"
|
||||
path="res://.godot/imported/trim-long.png-0b9b67642209f6a2ae4b2165f3b33d5d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://instruments/trim-long.png"
|
||||
dest_files=["res://.godot/imported/trim-long.png-0b9b67642209f6a2ae4b2165f3b33d5d.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
project/instruments/trim-short.png
(Stored with Git LFS)
Normal file
BIN
project/instruments/trim-short.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
project/instruments/trim-short.png.import
Normal file
34
project/instruments/trim-short.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dytpn8rcdimr"
|
||||
path="res://.godot/imported/trim-short.png-707c75166ad2d77e18c02dc4882968b1.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://instruments/trim-short.png"
|
||||
dest_files=["res://.godot/imported/trim-short.png-707c75166ad2d77e18c02dc4882968b1.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
Loading…
Add table
Add a link
Reference in a new issue