chore: restructured project
All checks were successful
Coding Quality / Build and analyze (pull_request) Successful in 2m10s
All checks were successful
Coding Quality / Build and analyze (pull_request) Successful in 2m10s
This commit is contained in:
BIN
Experiments/PidTest/Assets/PID_Spinning_Stuff.glb
Normal file
BIN
Experiments/PidTest/Assets/PID_Spinning_Stuff.glb
Normal file
Binary file not shown.
42
Experiments/PidTest/Assets/PID_Spinning_Stuff.glb.import
Normal file
42
Experiments/PidTest/Assets/PID_Spinning_Stuff.glb.import
Normal file
@@ -0,0 +1,42 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://b8yyluxikhlr0"
|
||||
path="res://.godot/imported/PID_Spinning_Stuff.glb-aa3b93bf47083b9724865d3bff0f5f1e.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Experiments/PidTest/Assets/PID_Spinning_Stuff.glb"
|
||||
dest_files=["res://.godot/imported/PID_Spinning_Stuff.glb-aa3b93bf47083b9724865d3bff0f5f1e.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=2
|
||||
gltf/embedded_image_handling=1
|
||||
BIN
Experiments/PidTest/Assets/PID_Spinning_Target.glb
Normal file
BIN
Experiments/PidTest/Assets/PID_Spinning_Target.glb
Normal file
Binary file not shown.
42
Experiments/PidTest/Assets/PID_Spinning_Target.glb.import
Normal file
42
Experiments/PidTest/Assets/PID_Spinning_Target.glb.import
Normal file
@@ -0,0 +1,42 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://cin3pgpeydkpe"
|
||||
path="res://.godot/imported/PID_Spinning_Target.glb-b494bd392644136f4ee2f4a9ca10e7bc.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Experiments/PidTest/Assets/PID_Spinning_Target.glb"
|
||||
dest_files=["res://.godot/imported/PID_Spinning_Target.glb-b494bd392644136f4ee2f4a9ca10e7bc.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=2
|
||||
gltf/embedded_image_handling=1
|
||||
BIN
Experiments/PidTest/Assets/PID_Test_Obj.blend
Normal file
BIN
Experiments/PidTest/Assets/PID_Test_Obj.blend
Normal file
Binary file not shown.
60
Experiments/PidTest/Assets/PID_Test_Obj.blend.import
Normal file
60
Experiments/PidTest/Assets/PID_Test_Obj.blend.import
Normal file
@@ -0,0 +1,60 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://c8ywajojvb7pw"
|
||||
path="res://.godot/imported/PID_Test_Obj.blend-49d06dd6be02191c02959431b2d686bf.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Experiments/PidTest/Assets/PID_Test_Obj.blend"
|
||||
dest_files=["res://.godot/imported/PID_Test_Obj.blend-49d06dd6be02191c02959431b2d686bf.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
blender/nodes/visible=0
|
||||
blender/nodes/active_collection_only=false
|
||||
blender/nodes/punctual_lights=true
|
||||
blender/nodes/cameras=true
|
||||
blender/nodes/custom_properties=true
|
||||
blender/nodes/modifiers=1
|
||||
blender/meshes/colors=false
|
||||
blender/meshes/uvs=true
|
||||
blender/meshes/normals=true
|
||||
blender/meshes/export_geometry_nodes_instances=false
|
||||
blender/meshes/gpu_instances=false
|
||||
blender/meshes/tangents=true
|
||||
blender/meshes/skins=2
|
||||
blender/meshes/export_bones_deforming_mesh_only=false
|
||||
blender/materials/unpack_enabled=true
|
||||
blender/materials/export_materials=1
|
||||
blender/animation/limit_playback=true
|
||||
blender/animation/always_sample=true
|
||||
blender/animation/group_tracks=true
|
||||
gltf/naming_version=2
|
||||
221
Experiments/PidTest/Scenes/pid_test.tscn
Normal file
221
Experiments/PidTest/Scenes/pid_test.tscn
Normal file
@@ -0,0 +1,221 @@
|
||||
[gd_scene format=3 uid="uid://caj5t8q1fii5m"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cin3pgpeydkpe" path="res://Experiments/PidTest/Assets/PID_Spinning_Target.glb" id="1_0c8sw"]
|
||||
[ext_resource type="Script" uid="uid://b63aqs33qyp0g" path="res://Experiments/PidTest/Scripts/pid_test.gd" id="1_sxbsa"]
|
||||
[ext_resource type="PackedScene" uid="uid://b8yyluxikhlr0" path="res://Experiments/PidTest/Assets/PID_Spinning_Stuff.glb" id="2_sxbsa"]
|
||||
|
||||
[sub_resource type="Environment" id="Environment_d03hh"]
|
||||
background_mode = 2
|
||||
background_color = Color(0.14478481, 0.14478481, 0.14478481, 1)
|
||||
ambient_light_source = 2
|
||||
|
||||
[sub_resource type="Theme" id="Theme_sxbsa"]
|
||||
|
||||
[sub_resource type="Theme" id="Theme_d03hh"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_sxbsa"]
|
||||
font_size = 24
|
||||
|
||||
[node name="PidTest" type="Node3D" unique_id=409732338]
|
||||
script = ExtResource("1_sxbsa")
|
||||
|
||||
[node name="Target" type="Node3D" parent="." unique_id=1892694980]
|
||||
|
||||
[node name="PID_Spinning_Target" parent="Target" unique_id=290681639 instance=ExtResource("1_0c8sw")]
|
||||
|
||||
[node name="Spinner" type="Node3D" parent="." unique_id=247778584]
|
||||
|
||||
[node name="PID_Spinning_Stuff" parent="Spinner" unique_id=1201678253 instance=ExtResource("2_sxbsa")]
|
||||
|
||||
[node name="OmniLight3D" type="OmniLight3D" parent="Spinner/PID_Spinning_Stuff" unique_id=2090020750]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.40560818, 0.6382216, 0)
|
||||
light_color = Color(0.99999994, 0.20727095, 0.32746297, 1)
|
||||
light_energy = 0.2
|
||||
shadow_enabled = true
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="." unique_id=1282499222]
|
||||
transform = Transform3D(-4.3597606e-08, -0.072106734, 0.99739695, -3.1518854e-09, 0.99739695, 0.072106734, -1, 0, -4.371139e-08, 4.3431935, 0.43207824, 0)
|
||||
environment = SubResource("Environment_d03hh")
|
||||
|
||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="." unique_id=1522897878]
|
||||
transform = Transform3D(0.25000006, 0.9659258, 0.06698735, -0.2588191, -1.9081726e-08, 0.9659258, 0.93301266, -0.25881913, 0.25000003, 0, 3.3288543, 0)
|
||||
|
||||
[node name="PID Menue" type="Control" parent="." unique_id=1859056208]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_left = 20.0
|
||||
offset_top = 20.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 20.0
|
||||
theme = SubResource("Theme_sxbsa")
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="PID Menue" unique_id=1246871103]
|
||||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="PID Menue/PanelContainer" unique_id=954080507]
|
||||
layout_mode = 2
|
||||
theme = SubResource("Theme_d03hh")
|
||||
|
||||
[node name="Spinner Header" type="Label" parent="PID Menue/PanelContainer/VBoxContainer" unique_id=1483799622]
|
||||
layout_mode = 2
|
||||
text = "Spinner Controll"
|
||||
label_settings = SubResource("LabelSettings_sxbsa")
|
||||
|
||||
[node name="Proportinal Term (P)" type="HBoxContainer" parent="PID Menue/PanelContainer/VBoxContainer" unique_id=1794698833]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="PID Menue/PanelContainer/VBoxContainer/Proportinal Term (P)" unique_id=1317903797]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Proportinal Term (P)"
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="PID Menue/PanelContainer/VBoxContainer/Proportinal Term (P)" unique_id=1758759405]
|
||||
custom_minimum_size = Vector2(20, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Input" type="SpinBox" parent="PID Menue/PanelContainer/VBoxContainer/Proportinal Term (P)" unique_id=1823143898]
|
||||
layout_mode = 2
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
value = 0.5
|
||||
|
||||
[node name="Integral (I)" type="HBoxContainer" parent="PID Menue/PanelContainer/VBoxContainer" unique_id=64519878]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="PID Menue/PanelContainer/VBoxContainer/Integral (I)" unique_id=1114350133]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Integral (I)"
|
||||
|
||||
[node name="Input" type="SpinBox" parent="PID Menue/PanelContainer/VBoxContainer/Integral (I)" unique_id=24991717]
|
||||
layout_mode = 2
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
|
||||
[node name="Derivative (D)" type="HBoxContainer" parent="PID Menue/PanelContainer/VBoxContainer" unique_id=373567523]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="PID Menue/PanelContainer/VBoxContainer/Derivative (D)" unique_id=1005009217]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Derivative (D)"
|
||||
|
||||
[node name="Input" type="SpinBox" parent="PID Menue/PanelContainer/VBoxContainer/Derivative (D)" unique_id=2125630530]
|
||||
layout_mode = 2
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
|
||||
[node name="Force" type="HBoxContainer" parent="PID Menue/PanelContainer/VBoxContainer" unique_id=372036544]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="PID Menue/PanelContainer/VBoxContainer/Force" unique_id=730787559]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Force"
|
||||
|
||||
[node name="Input" type="SpinBox" parent="PID Menue/PanelContainer/VBoxContainer/Force" unique_id=664419913]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="PID Menue/PanelContainer/VBoxContainer" unique_id=1594734591]
|
||||
custom_minimum_size = Vector2(0, 20)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Target Header" type="Label" parent="PID Menue/PanelContainer/VBoxContainer" unique_id=840305492]
|
||||
layout_mode = 2
|
||||
text = "Target"
|
||||
label_settings = SubResource("LabelSettings_sxbsa")
|
||||
|
||||
[node name="Target Rotation" type="HBoxContainer" parent="PID Menue/PanelContainer/VBoxContainer" unique_id=1817766875]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="PID Menue/PanelContainer/VBoxContainer/Target Rotation" unique_id=434163315]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Target Rotation"
|
||||
|
||||
[node name="Input" type="SpinBox" parent="PID Menue/PanelContainer/VBoxContainer/Target Rotation" unique_id=702580921]
|
||||
layout_mode = 2
|
||||
max_value = 1439.96
|
||||
step = 0.01
|
||||
custom_arrow_step = 10.0
|
||||
|
||||
[node name="MarginContainer2" type="MarginContainer" parent="PID Menue/PanelContainer/VBoxContainer" unique_id=1993364980]
|
||||
custom_minimum_size = Vector2(0, 20)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Solution" type="Label" parent="PID Menue/PanelContainer/VBoxContainer" unique_id=1363644963]
|
||||
layout_mode = 2
|
||||
text = "Solution"
|
||||
label_settings = SubResource("LabelSettings_sxbsa")
|
||||
|
||||
[node name="Error" type="HBoxContainer" parent="PID Menue/PanelContainer/VBoxContainer" unique_id=1710432059]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="PID Menue/PanelContainer/VBoxContainer/Error" unique_id=20360049]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Error"
|
||||
|
||||
[node name="Output" type="Label" parent="PID Menue/PanelContainer/VBoxContainer/Error" unique_id=220452512]
|
||||
layout_mode = 2
|
||||
text = "000.00"
|
||||
horizontal_alignment = 1
|
||||
uppercase = true
|
||||
|
||||
[node name="Error Derivative" type="HBoxContainer" parent="PID Menue/PanelContainer/VBoxContainer" unique_id=257500719]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="PID Menue/PanelContainer/VBoxContainer/Error Derivative" unique_id=520180909]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Error Derivative"
|
||||
|
||||
[node name="Output" type="Label" parent="PID Menue/PanelContainer/VBoxContainer/Error Derivative" unique_id=376634574]
|
||||
layout_mode = 2
|
||||
text = "000.00"
|
||||
horizontal_alignment = 1
|
||||
uppercase = true
|
||||
|
||||
[node name="Integral" type="HBoxContainer" parent="PID Menue/PanelContainer/VBoxContainer" unique_id=1906698794]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="PID Menue/PanelContainer/VBoxContainer/Integral" unique_id=1621802829]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Integral"
|
||||
|
||||
[node name="Output" type="Label" parent="PID Menue/PanelContainer/VBoxContainer/Integral" unique_id=1321401490]
|
||||
layout_mode = 2
|
||||
text = "000.00"
|
||||
horizontal_alignment = 1
|
||||
uppercase = true
|
||||
|
||||
[node name="Speed" type="HBoxContainer" parent="PID Menue/PanelContainer/VBoxContainer" unique_id=1485477014]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="PID Menue/PanelContainer/VBoxContainer/Speed" unique_id=363468111]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Speed"
|
||||
|
||||
[node name="Output" type="Label" parent="PID Menue/PanelContainer/VBoxContainer/Speed" unique_id=1947341639]
|
||||
layout_mode = 2
|
||||
text = "000.00"
|
||||
horizontal_alignment = 1
|
||||
uppercase = true
|
||||
|
||||
[node name="Acceleration" type="HBoxContainer" parent="PID Menue/PanelContainer/VBoxContainer" unique_id=1814146417]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="PID Menue/PanelContainer/VBoxContainer/Acceleration" unique_id=1879879740]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Acceleration"
|
||||
|
||||
[node name="Output" type="Label" parent="PID Menue/PanelContainer/VBoxContainer/Acceleration" unique_id=1647345306]
|
||||
layout_mode = 2
|
||||
text = "000.00"
|
||||
horizontal_alignment = 1
|
||||
uppercase = true
|
||||
115
Experiments/PidTest/Scripts/pid_test.gd
Normal file
115
Experiments/PidTest/Scripts/pid_test.gd
Normal file
@@ -0,0 +1,115 @@
|
||||
extends Node3D
|
||||
|
||||
var p: float = 0.4
|
||||
var i: float = 0.0
|
||||
var d: float = 1
|
||||
|
||||
var force: float = 200.0
|
||||
var error: float = 0.0
|
||||
var last_error = 0.0
|
||||
var error_derivative: float = 0.0
|
||||
var integral: float = 0.0
|
||||
var target: float = 0.0 #0.0 -> 359.99
|
||||
|
||||
var p_input: SpinBox
|
||||
var i_input: SpinBox
|
||||
var d_input: SpinBox
|
||||
var force_input: SpinBox
|
||||
var target_input: SpinBox
|
||||
|
||||
var spinner_node: Node3D
|
||||
var target_node: Node3D
|
||||
var error_lable: Label
|
||||
var speed_lable: Label
|
||||
var acceleration_label: Label
|
||||
var error_derivative_lable: Label
|
||||
var integral_lable: Label
|
||||
|
||||
var spinner_speed: float = 0.0
|
||||
var max_speed: float = 120 # deg/m -> 1/360/60s = 1rpm
|
||||
var acceleration: float
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
spinner_node = get_node("Spinner")
|
||||
target_node = get_node("Target")
|
||||
|
||||
p_input = get_node("PID Menue/PanelContainer/VBoxContainer/Proportinal Term (P)/Input")
|
||||
p_input.value_changed.connect(_update_p_value)
|
||||
|
||||
i_input = get_node("PID Menue/PanelContainer/VBoxContainer/Integral (I)/Input")
|
||||
i_input.value_changed.connect(_update_i_value)
|
||||
|
||||
d_input = get_node("PID Menue/PanelContainer/VBoxContainer/Derivative (D)/Input")
|
||||
d_input.value_changed.connect(_update_d_value)
|
||||
|
||||
force_input = get_node("PID Menue/PanelContainer/VBoxContainer/Force/Input")
|
||||
force_input.value_changed.connect(_update_force_value)
|
||||
|
||||
target_input = get_node("PID Menue/PanelContainer/VBoxContainer/Target Rotation/Input")
|
||||
target_input.value_changed.connect(_update_target_rot)
|
||||
|
||||
error_lable = get_node("PID Menue/PanelContainer/VBoxContainer/Error/Output")
|
||||
speed_lable = get_node("PID Menue/PanelContainer/VBoxContainer/Speed/Output")
|
||||
error_derivative_lable = get_node("PID Menue/PanelContainer/VBoxContainer/Error Derivative/Output")
|
||||
acceleration_label = get_node("PID Menue/PanelContainer/VBoxContainer/Acceleration/Output")
|
||||
integral_lable = get_node("PID Menue/PanelContainer/VBoxContainer/Integral/Output")
|
||||
|
||||
# Set default values
|
||||
p_input.value = p
|
||||
i_input.value = i
|
||||
d_input.value = d
|
||||
force_input.value = force
|
||||
|
||||
|
||||
func _update_target_rot(value: float) -> void:
|
||||
target_node.rotation.x = deg_to_rad(value)
|
||||
|
||||
|
||||
func _update_p_value(value: float) -> void:
|
||||
p = value
|
||||
|
||||
|
||||
func _update_i_value(value: float) -> void:
|
||||
i = value
|
||||
|
||||
|
||||
func _update_d_value(value: float) -> void:
|
||||
d = value
|
||||
|
||||
|
||||
func _update_force_value(value: float) -> void:
|
||||
force = value
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
# PID Stuff
|
||||
target = rad_to_deg(target_node.rotation.x)
|
||||
error = target - rad_to_deg(spinner_node.rotation.x)
|
||||
error_derivative = (error - last_error) / delta
|
||||
integral += error * delta
|
||||
|
||||
# Clamp acceleration between min and max force
|
||||
var pid_output := (p * error) + (i * integral) + (d * error_derivative)
|
||||
acceleration = clampf(pid_output, -force, force)
|
||||
# Set speed
|
||||
var next_speed = spinner_speed + acceleration * delta
|
||||
|
||||
# Block acceleration that would exceed max speed
|
||||
if abs(spinner_speed) >= max_speed and sign(acceleration) == sign(spinner_speed):
|
||||
acceleration = 0.0
|
||||
next_speed = spinner_speed
|
||||
|
||||
spinner_speed = clamp(next_speed, -max_speed, max_speed)
|
||||
spinner_node.rotation_degrees.x += spinner_speed * delta
|
||||
|
||||
last_error = error
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
#UI Updats
|
||||
error_lable.text = str(error).pad_decimals(2).pad_zeros(3) + " deg"
|
||||
error_derivative_lable.text = str(error_derivative).pad_decimals(2).pad_zeros(3)
|
||||
integral_lable.text = str(integral).pad_decimals(2).pad_zeros(3)
|
||||
speed_lable.text = str(spinner_speed).pad_decimals(2).pad_zeros(3) + " deg/m"
|
||||
acceleration_label.text = str(acceleration / force * 100).pad_decimals(2).pad_zeros(3) + " %"
|
||||
1
Experiments/PidTest/Scripts/pid_test.gd.uid
Normal file
1
Experiments/PidTest/Scripts/pid_test.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b63aqs33qyp0g
|
||||
1
Experiments/Recuration/Assets/TheMoon/TheMoon.gd
Normal file
1
Experiments/Recuration/Assets/TheMoon/TheMoon.gd
Normal file
@@ -0,0 +1 @@
|
||||
extends Node2D
|
||||
1
Experiments/Recuration/Assets/TheMoon/TheMoon.gd.uid
Normal file
1
Experiments/Recuration/Assets/TheMoon/TheMoon.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://1c5nfdg2aud4
|
||||
37
Experiments/Recuration/Assets/TheMoon/TheMoon.tscn
Normal file
37
Experiments/Recuration/Assets/TheMoon/TheMoon.tscn
Normal file
@@ -0,0 +1,37 @@
|
||||
[gd_scene format=3 uid="uid://o2egm85y3wul"]
|
||||
|
||||
[ext_resource type="Script" path="res://Experiments/Recuration/Assets/TheMoon/TheMoon.gd" id="1_sr6fy"]
|
||||
[ext_resource type="Texture2D" uid="uid://dng410xo7qqfv" path="res://Core/Assets/PixelPlanets/a-moon.png" id="2_oy8k5"]
|
||||
|
||||
[node name="TheMoon" type="Node2D" unique_id=1994078602]
|
||||
script = ExtResource("1_sr6fy")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1777467462]
|
||||
texture_filter = 1
|
||||
texture_repeat = 1
|
||||
texture = ExtResource("2_oy8k5")
|
||||
|
||||
[node name="Control" type="Control" parent="." unique_id=1752474701]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_left = 20.0
|
||||
offset_top = 20.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 20.0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Control" unique_id=61689214]
|
||||
layout_mode = 0
|
||||
offset_right = 110.0
|
||||
offset_bottom = 77.0
|
||||
|
||||
[node name="Label" type="Label" parent="Control/VBoxContainer" unique_id=1786036540]
|
||||
layout_mode = 2
|
||||
text = "Iron"
|
||||
|
||||
[node name="Label2" type="Label" parent="Control/VBoxContainer" unique_id=374559952]
|
||||
layout_mode = 2
|
||||
text = "Copper"
|
||||
|
||||
[node name="Label3" type="Label" parent="Control/VBoxContainer" unique_id=1739358724]
|
||||
layout_mode = 2
|
||||
text = "Copper"
|
||||
4
Experiments/Recuration/Planning/Movement 2D.svg
Normal file
4
Experiments/Recuration/Planning/Movement 2D.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 15 KiB |
43
Experiments/Recuration/Planning/Movement 2D.svg.import
Normal file
43
Experiments/Recuration/Planning/Movement 2D.svg.import
Normal file
@@ -0,0 +1,43 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://pyvdyr3pes5o"
|
||||
path="res://.godot/imported/Movement 2D.svg-4fa99617f74c694e4d2141eda40271bc.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Experiments/Recuration/Planning/Movement 2D.svg"
|
||||
dest_files=["res://.godot/imported/Movement 2D.svg-4fa99617f74c694e4d2141eda40271bc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
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/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
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
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
17
Experiments/Recuration/Scenes/Recuration.tscn
Normal file
17
Experiments/Recuration/Scenes/Recuration.tscn
Normal file
@@ -0,0 +1,17 @@
|
||||
[gd_scene format=3 uid="uid://cycayd4l7k7s4"]
|
||||
|
||||
[ext_resource type="Script" path="res://Experiments/Recuration/Scripts/RecurionCamera.gd" id="1_002bs"]
|
||||
[ext_resource type="PackedScene" uid="uid://cbqapc1frbhtv" path="res://Experiments/Recuration/UI/UI.tscn" id="2_qgdyp"]
|
||||
[ext_resource type="PackedScene" uid="uid://o2egm85y3wul" path="res://Experiments/Recuration/Assets/TheMoon/TheMoon.tscn" id="3_yu4li"]
|
||||
|
||||
[node name="Recuration" type="Node2D" unique_id=1741828961]
|
||||
|
||||
[node name="RecurionCamera" type="Camera2D" parent="." unique_id=997983592]
|
||||
script = ExtResource("1_002bs")
|
||||
movement_speed = 10.0
|
||||
metadata/_custom_type_script = "uid://bqslv86lm78ci"
|
||||
|
||||
[node name="Ui" parent="RecurionCamera" unique_id=1649292342 instance=ExtResource("2_qgdyp")]
|
||||
|
||||
[node name="TheMoon" parent="." unique_id=1994078602 instance=ExtResource("3_yu4li")]
|
||||
position = Vector2(-181, -79)
|
||||
52
Experiments/Recuration/Scripts/RecurionCamera.gd
Normal file
52
Experiments/Recuration/Scripts/RecurionCamera.gd
Normal file
@@ -0,0 +1,52 @@
|
||||
extends Camera2D
|
||||
|
||||
class_name RecurionCamera
|
||||
|
||||
@export var movement_speed: float = 1
|
||||
|
||||
var mouse_pos_a: Vector2 = Vector2.ZERO
|
||||
var mouse_pos_b: Vector2 = Vector2.ZERO
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
process_keyboard_input(delta)
|
||||
process_mouse_input()
|
||||
|
||||
|
||||
func process_keyboard_input(delta: float):
|
||||
var direction: Vector2 = Vector2.ZERO
|
||||
|
||||
if (Input.is_action_pressed("w")):
|
||||
direction += Vector2.UP
|
||||
if (Input.is_action_pressed("s")):
|
||||
direction += Vector2.DOWN
|
||||
if (Input.is_action_pressed("a")):
|
||||
direction += Vector2.LEFT
|
||||
if (Input.is_action_pressed("d")):
|
||||
direction += Vector2.RIGHT
|
||||
direction = direction.normalized() * movement_speed
|
||||
position += direction * delta * 100
|
||||
|
||||
|
||||
func process_mouse_input():
|
||||
if (Input.is_action_just_pressed("mouse_down")):
|
||||
mouse_pos_a = get_global_mouse_position()
|
||||
mouse_pos_b = mouse_pos_a
|
||||
|
||||
elif (Input.is_action_pressed("mouse_down")):
|
||||
mouse_pos_b = get_global_mouse_position()
|
||||
|
||||
position = mouse_pos_a - mouse_pos_b + position
|
||||
|
||||
elif (Input.is_action_just_released("mouse_down")):
|
||||
mouse_pos_a = Vector2.ZERO
|
||||
mouse_pos_b = Vector2.ZERO
|
||||
|
||||
mouse_pos_b = mouse_pos_a
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if (event is InputEventMouseButton):
|
||||
var zoom_value = Input.get_axis("scroll_down", "scroll_up")
|
||||
if (zoom.y + zoom_value > 0.0):
|
||||
zoom += Vector2.ONE * zoom_value
|
||||
1
Experiments/Recuration/Scripts/RecurionCamera.gd.uid
Normal file
1
Experiments/Recuration/Scripts/RecurionCamera.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bqslv86lm78ci
|
||||
1
Experiments/Recuration/Scripts/ResourceComponent.gd
Normal file
1
Experiments/Recuration/Scripts/ResourceComponent.gd
Normal file
@@ -0,0 +1 @@
|
||||
extends Node
|
||||
1
Experiments/Recuration/Scripts/ResourceComponent.gd.uid
Normal file
1
Experiments/Recuration/Scripts/ResourceComponent.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bqlwhd5slcp0h
|
||||
12
Experiments/Recuration/UI/UI.tscn
Normal file
12
Experiments/Recuration/UI/UI.tscn
Normal file
@@ -0,0 +1,12 @@
|
||||
[gd_scene format=3 uid="uid://cbqapc1frbhtv"]
|
||||
|
||||
[ext_resource type="Script" path="res://Experiments/Recuration/UI/ui.gd" id="1_0oc4u"]
|
||||
|
||||
[node name="Ui" type="Control" unique_id=1649292342]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_0oc4u")
|
||||
1
Experiments/Recuration/UI/ui.gd
Normal file
1
Experiments/Recuration/UI/ui.gd
Normal file
@@ -0,0 +1 @@
|
||||
extends Control
|
||||
1
Experiments/Recuration/UI/ui.gd.uid
Normal file
1
Experiments/Recuration/UI/ui.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dslwh6krdrhb
|
||||
49
Experiments/SpaceMove/Assets/player_ship.tscn
Normal file
49
Experiments/SpaceMove/Assets/player_ship.tscn
Normal file
@@ -0,0 +1,49 @@
|
||||
[gd_scene format=3 uid="uid://c8tm1q2cp567o"]
|
||||
|
||||
[ext_resource type="Script" path="res://Experiments/SpaceMove/Scripts/player_ship.gd" id="1_3yydb"]
|
||||
[ext_resource type="Script" path="res://Experiments/SpaceMove/Scripts/shipAiComponent.gd" id="2_vr0dq"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_tjnu1"]
|
||||
radius = 1.48237
|
||||
height = 3.89605
|
||||
|
||||
[sub_resource type="PrismMesh" id="PrismMesh_tjnu1"]
|
||||
|
||||
[sub_resource type="CylinderMesh" id="CylinderMesh_3yydb"]
|
||||
|
||||
[node name="PlayerShip" type="RigidBody3D"]
|
||||
script = ExtResource("1_3yydb")
|
||||
_start_direction = Vector3(0, 0, -50)
|
||||
_start_speed = 1.0
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, -0.358494)
|
||||
shape = SubResource("CapsuleShape3D_tjnu1")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="CollisionShape3D"]
|
||||
transform = Transform3D(2.20781, 0, 0, 0, -9.18077e-08, -1.7005, 0, 2.10032, -7.43314e-08, 0, 0.524807, 0.378866)
|
||||
mesh = SubResource("PrismMesh_tjnu1")
|
||||
skeleton = NodePath("../..")
|
||||
|
||||
[node name="MeshInstance3D2" type="MeshInstance3D" parent="CollisionShape3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.475193, -2.07714e-08)
|
||||
mesh = SubResource("CylinderMesh_3yydb")
|
||||
skeleton = NodePath("../..")
|
||||
|
||||
[node name="ShipAiComponent" type="Node" parent="."]
|
||||
script = ExtResource("2_vr0dq")
|
||||
metadata/_custom_type_script = "uid://ci33hs6nbuhqr"
|
||||
|
||||
[node name="Label3D" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.32815, 0)
|
||||
billboard = 2
|
||||
no_depth_test = true
|
||||
render_priority = 1
|
||||
text = "Text"
|
||||
font_size = 128
|
||||
|
||||
[node name="RayCast3D" type="RayCast3D" parent="."]
|
||||
target_position = Vector3(0, 0, 0)
|
||||
hit_from_inside = true
|
||||
collide_with_areas = true
|
||||
debug_shape_custom_color = Color(0.712962, 0.712962, 0.712962, 1)
|
||||
71
Experiments/SpaceMove/Scenes/space_test.tscn
Normal file
71
Experiments/SpaceMove/Scenes/space_test.tscn
Normal file
@@ -0,0 +1,71 @@
|
||||
[gd_scene format=3 uid="uid://dgst4apmowe53"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cc7e4loxpb1x6" path="res://Experiments/ThrusterCube/Scenes/obstacle.tscn" id="1_ig7tw"]
|
||||
[ext_resource type="PackedScene" uid="uid://c8tm1q2cp567o" path="res://Experiments/SpaceMove/Assets/player_ship.tscn" id="2_0xm2m"]
|
||||
[ext_resource type="PackedScene" uid="uid://1al1ysn5q5yk" path="res://Experiments/ThrusterCube/Scenes/thruster_cube.tscn" id="3_h2yge"]
|
||||
[ext_resource type="Script" path="res://Experiments/SpaceMove/Scripts/player_ship.gd" id="4_10w3i"]
|
||||
|
||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_hsoxx"]
|
||||
|
||||
[sub_resource type="Sky" id="Sky_gojnm"]
|
||||
sky_material = SubResource("ProceduralSkyMaterial_hsoxx")
|
||||
process_mode = 1
|
||||
|
||||
[sub_resource type="Environment" id="Environment_hsoxx"]
|
||||
background_mode = 2
|
||||
sky = SubResource("Sky_gojnm")
|
||||
ambient_light_source = 3
|
||||
ambient_light_color = Color(1, 1, 1, 1)
|
||||
|
||||
[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_1c2mv"]
|
||||
|
||||
[sub_resource type="SphereMesh" id="SphereMesh_0xm2m"]
|
||||
|
||||
[sub_resource type="PlaneMesh" id="PlaneMesh_h2yge"]
|
||||
|
||||
[node name="TestLevel" type="Node3D" unique_id=652844344]
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="." unique_id=150721961]
|
||||
transform = Transform3D(0.998445, -0.0179374, 0.0527875, -9.30799e-10, 0.946829, 0.321737, -0.0557519, -0.321236, 0.945357, 0.181835, 5.6324, 24.1051)
|
||||
fov = 50.4
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=972963566]
|
||||
environment = SubResource("Environment_hsoxx")
|
||||
camera_attributes = SubResource("CameraAttributesPractical_1c2mv")
|
||||
|
||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="." unique_id=419392911]
|
||||
transform = Transform3D(0.933305, -0.340159, 0.115038, 0, 0.320365, 0.947294, -0.359085, -0.884114, 0.298998, 0, 1.65681, 0)
|
||||
|
||||
[node name="Node" type="Node3D" parent="." unique_id=1060338205]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.112919, -16.6481, 0.0137749)
|
||||
|
||||
[node name="Obstacle" parent="Node" unique_id=1151336365 instance=ExtResource("1_ig7tw")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.528058, 1.09307, -4.11262)
|
||||
|
||||
[node name="PlayerShip" parent="Node" unique_id=1169721436 instance=ExtResource("2_0xm2m")]
|
||||
transform = Transform3D(-0.0337657, 0, -0.99943, 0, 1, 0, 0.99943, 0, -0.0337657, -20.7388, 9.76772, -1.42542)
|
||||
_start_direction = Vector3(1, 0.5, 0)
|
||||
_start_speed = 100.0
|
||||
|
||||
[node name="Marker3D" type="Marker3D" parent="Node" unique_id=1294508738]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.147182, -10.5201)
|
||||
gizmo_extents = 5.03
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="Node/Marker3D" unique_id=545308513]
|
||||
transform = Transform3D(0.189904, 0, 0, 0, 0.189904, 0, 0, 0, 0.189904, 0, 0, 0)
|
||||
mesh = SubResource("SphereMesh_0xm2m")
|
||||
|
||||
[node name="Obstacle2" parent="Node" unique_id=579337740 instance=ExtResource("1_ig7tw")]
|
||||
transform = Transform3D(0.635485, -0.772113, 0, 0.772113, 0.635485, 0, 0, 0, 1, -6.93043, 24.3938, -1.34355)
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="Node" unique_id=257615271]
|
||||
transform = Transform3D(11.7541, 0, 0, 0, 1, 0, 0, 0, 11.7541, 0, -7, 0)
|
||||
mesh = SubResource("PlaneMesh_h2yge")
|
||||
skeleton = NodePath("../..")
|
||||
|
||||
[node name="Thruster Cube" parent="." unique_id=580986924 instance=ExtResource("3_h2yge")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -11.2033)
|
||||
mass = 200.0
|
||||
script = ExtResource("4_10w3i")
|
||||
_start_direction = Vector3(0, 0, 0)
|
||||
_start_speed = 0.0
|
||||
8
Experiments/SpaceMove/Scripts/player_ship.gd
Normal file
8
Experiments/SpaceMove/Scripts/player_ship.gd
Normal file
@@ -0,0 +1,8 @@
|
||||
extends RigidBody3D
|
||||
|
||||
@export var _start_direction: Vector3
|
||||
@export var _start_speed: float
|
||||
|
||||
func _ready():
|
||||
# apply_force(_, global_position)
|
||||
apply_central_force(_start_direction.normalized() * _start_speed)
|
||||
1
Experiments/SpaceMove/Scripts/player_ship.gd.uid
Normal file
1
Experiments/SpaceMove/Scripts/player_ship.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ccnbhjxglgw12
|
||||
40
Experiments/SpaceMove/Scripts/shipAiComponent.gd
Normal file
40
Experiments/SpaceMove/Scripts/shipAiComponent.gd
Normal file
@@ -0,0 +1,40 @@
|
||||
extends Node
|
||||
class_name ShipAiComponent
|
||||
|
||||
var text: Label3D
|
||||
var colShape: CollisionShape3D
|
||||
var distText = "Distance to collision: "
|
||||
var secText = "Seconds to collision: "
|
||||
|
||||
var dist = 0.0
|
||||
var collision = 0.0
|
||||
|
||||
func _ready():
|
||||
text = $"../Label3D"
|
||||
colShape = $"../CollisionShape3D"
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
calcColDist(delta)
|
||||
|
||||
text.text = distText + String("%0.2f" % dist) + " Meters\n" + secText + String("%0.2f" % collision) + " Seconds"
|
||||
|
||||
func calcColDist(_delta) -> void:
|
||||
var rigidBody: RigidBody3D = $".."
|
||||
var rayCast: RayCast3D = $"../RayCast3D"
|
||||
var pos = rigidBody.global_position
|
||||
var linearVelocity = rigidBody.linear_velocity.normalized() * 100
|
||||
|
||||
rayCast.target_position = rigidBody.to_local(linearVelocity)
|
||||
# rayCast.rotation = rigidBody.rotation
|
||||
# rayCast.position = pos
|
||||
if rayCast.is_colliding():
|
||||
dist = (rayCast.get_collision_point() - pos).length() - 2.5 # Ship size-> eg. bounding box
|
||||
collision = dist / rigidBody.linear_velocity.length()
|
||||
if (collision <= 0.0):
|
||||
collision = 0.0
|
||||
|
||||
|
||||
else:
|
||||
dist = 0.0
|
||||
collision = 0.0
|
||||
1
Experiments/SpaceMove/Scripts/shipAiComponent.gd.uid
Normal file
1
Experiments/SpaceMove/Scripts/shipAiComponent.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ci33hs6nbuhqr
|
||||
BIN
Experiments/ThrusterCube/Assets/Thruster Cube Collision.glb
Normal file
BIN
Experiments/ThrusterCube/Assets/Thruster Cube Collision.glb
Normal file
Binary file not shown.
@@ -0,0 +1,42 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://crfjfbhjuderh"
|
||||
path="res://.godot/imported/Thruster Cube Collision.glb-e4567795df54acdcaed8b44a3b1cdf8a.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Experiments/ThrusterCube/Assets/Thruster Cube Collision.glb"
|
||||
dest_files=["res://.godot/imported/Thruster Cube Collision.glb-e4567795df54acdcaed8b44a3b1cdf8a.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type="CollisionShape3D"
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=1
|
||||
gltf/embedded_image_handling=0
|
||||
12
Experiments/ThrusterCube/Assets/Thruster Cube Collision.mtl
Normal file
12
Experiments/ThrusterCube/Assets/Thruster Cube Collision.mtl
Normal file
@@ -0,0 +1,12 @@
|
||||
# Blender 4.5.1 LTS MTL File: 'Thruster Cube Collision.blend'
|
||||
# www.blender.org
|
||||
|
||||
newmtl Standard.001
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.244501 0.244501 0.244501
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.500000
|
||||
d 1.000000
|
||||
illum 2
|
||||
1097
Experiments/ThrusterCube/Assets/Thruster Cube Collision.obj
Normal file
1097
Experiments/ThrusterCube/Assets/Thruster Cube Collision.obj
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,25 @@
|
||||
[remap]
|
||||
|
||||
importer="wavefront_obj"
|
||||
importer_version=1
|
||||
type="Mesh"
|
||||
uid="uid://c7f1y6fhexbhm"
|
||||
path="res://.godot/imported/Thruster Cube Collision.obj-c54c1e160e870d82560d1c443ddeae58.mesh"
|
||||
|
||||
[deps]
|
||||
|
||||
files=["res://.godot/imported/Thruster Cube Collision.obj-c54c1e160e870d82560d1c443ddeae58.mesh"]
|
||||
|
||||
source_file="res://Experiments/ThrusterCube/Assets/Thruster Cube Collision.obj"
|
||||
dest_files=["res://.godot/imported/Thruster Cube Collision.obj-c54c1e160e870d82560d1c443ddeae58.mesh", "res://.godot/imported/Thruster Cube Collision.obj-c54c1e160e870d82560d1c443ddeae58.mesh"]
|
||||
|
||||
[params]
|
||||
|
||||
generate_tangents=true
|
||||
generate_lods=true
|
||||
generate_shadow_mesh=true
|
||||
generate_lightmap_uv2=false
|
||||
generate_lightmap_uv2_texel_size=0.2
|
||||
scale_mesh=Vector3(1, 1, 1)
|
||||
offset_mesh=Vector3(0, 0, 0)
|
||||
force_disable_mesh_compression=false
|
||||
BIN
Experiments/ThrusterCube/Assets/Thruster Cube.glb
Normal file
BIN
Experiments/ThrusterCube/Assets/Thruster Cube.glb
Normal file
Binary file not shown.
42
Experiments/ThrusterCube/Assets/Thruster Cube.glb.import
Normal file
42
Experiments/ThrusterCube/Assets/Thruster Cube.glb.import
Normal file
@@ -0,0 +1,42 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://cmiwlha25agl4"
|
||||
path="res://.godot/imported/Thruster Cube.glb-591643872d53aaa419a7d06c5a20d845.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Experiments/ThrusterCube/Assets/Thruster Cube.glb"
|
||||
dest_files=["res://.godot/imported/Thruster Cube.glb-591643872d53aaa419a7d06c5a20d845.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type="RigidBody3D"
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=1
|
||||
gltf/embedded_image_handling=1
|
||||
15
Experiments/ThrusterCube/Scenes/obstacle.tscn
Normal file
15
Experiments/ThrusterCube/Scenes/obstacle.tscn
Normal file
@@ -0,0 +1,15 @@
|
||||
[gd_scene format=3 uid="uid://cc7e4loxpb1x6"]
|
||||
|
||||
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_lapuk"]
|
||||
points = PackedVector3Array(-0.5, -1, 0, -0.497651, -1, -0.0490407, -0.497651, -1, 0.0489429, -0.5, 1, 0, -0.490407, -1, -0.097592, -0.497651, 1, -0.0490407, -0.490407, -1, 0.0974941, -0.497651, 1, 0.0489429, -0.478563, -1, -0.145164, -0.490407, 1, -0.097592, -0.478563, -1, 0.145067, -0.490407, 1, 0.0974941, -0.46202, -1, -0.191366, -0.478563, 1, -0.145164, -0.46202, -1, 0.191269, -0.478563, 1, 0.145067, -0.440975, -1, -0.235709, -0.46202, 1, -0.191366, -0.440975, -1, 0.235611, -0.46202, 1, 0.191269, -0.415818, -1, -0.2778, -0.440975, 1, -0.235709, -0.415818, -1, 0.277702, -0.440975, 1, 0.235611, -0.386551, -1, -0.317247, -0.415818, 1, -0.2778, -0.386551, -1, 0.31715, -0.415818, 1, 0.277702, -0.353563, -1, -0.353563, -0.386551, 1, -0.317247, -0.353563, -1, 0.353465, -0.386551, 1, 0.31715, -0.317247, -1, -0.386551, -0.353563, 1, -0.353563, -0.317247, -1, 0.386453, -0.353563, 1, 0.353465, -0.2778, -1, -0.415818, -0.317247, 1, -0.386551, -0.2778, -1, 0.41572, -0.317247, 1, 0.386453, -0.235709, -1, -0.440975, -0.2778, 1, -0.415818, -0.235709, -1, 0.440877, -0.2778, 1, 0.41572, -0.191366, -1, -0.46202, -0.235709, 1, -0.440975, -0.191366, -1, 0.461922, -0.235709, 1, 0.440877, -0.145164, -1, -0.478563, -0.191366, 1, -0.46202, -0.145164, -1, 0.478465, -0.191366, 1, 0.461922, -0.097592, -1, -0.490407, -0.145164, 1, -0.478563, -0.097592, -1, 0.490309, -0.145164, 1, 0.478465, -0.0490407, -1, -0.497651, -0.097592, 1, -0.490407, -0.0490407, -1, 0.497553, -0.097592, 1, 0.490309, 0, -1, -0.5, -0.0490407, 1, -0.497651, 0, -1, 0.5, -0.0490407, 1, 0.497553, 0.0489429, -1, -0.497651, 0, 1, -0.5, 0.0489429, -1, 0.497553, 0, 1, 0.5, 0.0974941, -1, -0.490407, 0.0489429, 1, -0.497651, 0.0974941, -1, 0.490309, 0.0489429, 1, 0.497553, 0.145067, -1, -0.478563, 0.0974941, 1, -0.490407, 0.145067, -1, 0.478465, 0.0974941, 1, 0.490309, 0.191269, -1, -0.46202, 0.145067, 1, -0.478563, 0.191269, -1, 0.461922, 0.145067, 1, 0.478465, 0.235611, -1, -0.440975, 0.191269, 1, -0.46202, 0.235611, -1, 0.440877, 0.191269, 1, 0.461922, 0.277702, -1, -0.415818, 0.235611, 1, -0.440975, 0.277702, -1, 0.41572, 0.235611, 1, 0.440877, 0.31715, -1, -0.386551, 0.277702, 1, -0.415818, 0.31715, -1, 0.386453, 0.277702, 1, 0.41572, 0.353465, -1, -0.353563, 0.31715, 1, -0.386551, 0.353465, -1, 0.353465, 0.31715, 1, 0.386453, 0.386453, -1, -0.317247, 0.353465, 1, -0.353563, 0.386453, -1, 0.31715, 0.353465, 1, 0.353465, 0.41572, -1, -0.2778, 0.386453, 1, -0.317247, 0.41572, -1, 0.277702, 0.386453, 1, 0.31715, 0.440877, -1, -0.235709, 0.41572, 1, -0.2778, 0.440877, -1, 0.235611, 0.41572, 1, 0.277702, 0.461922, -1, -0.191366, 0.440877, 1, -0.235709, 0.461922, -1, 0.191269, 0.440877, 1, 0.235611, 0.478465, -1, -0.145164, 0.461922, 1, -0.191366, 0.478465, -1, 0.145067, 0.461922, 1, 0.191269, 0.490309, -1, -0.097592, 0.478465, 1, -0.145164, 0.490309, -1, 0.0974941, 0.478465, 1, 0.145067, 0.497553, -1, -0.0490407, 0.490309, 1, -0.097592, 0.497553, -1, 0.0489429, 0.490309, 1, 0.0974941, 0.5, -1, 0, 0.497553, 1, -0.0490407, 0.497553, 1, 0.0489429, 0.5, 1, 0)
|
||||
|
||||
[sub_resource type="CylinderMesh" id="CylinderMesh_cy40f"]
|
||||
|
||||
[node name="Obstacle" type="StaticBody3D"]
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource("ConvexPolygonShape3D_lapuk")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="CollisionShape3D"]
|
||||
mesh = SubResource("CylinderMesh_cy40f")
|
||||
skeleton = NodePath("../..")
|
||||
37
Experiments/ThrusterCube/Scenes/thruster_cube.tscn
Normal file
37
Experiments/ThrusterCube/Scenes/thruster_cube.tscn
Normal file
@@ -0,0 +1,37 @@
|
||||
[gd_scene format=3 uid="uid://1al1ysn5q5yk"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cmiwlha25agl4" path="res://Experiments/ThrusterCube/Assets/Thruster Cube.glb" id="1_48yjx"]
|
||||
[ext_resource type="Script" path="res://Experiments/PidTest/Scripts/pid_test.gd" id="2_j3sme"]
|
||||
|
||||
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_48yjx"]
|
||||
points = PackedVector3Array(5.05799, 3.09144, 8.02469, 5.05799, -3.09243, 8.02469, 5.05799, 3.72121, 7.41253, 4.99561, 3.99253, 9.40488, 5.05799, -3.7222, 7.41253, 4.99561, -3.99352, 9.40488, 5.05799, 3.72121, -8.54888, 4.99561, 4.98769, 8.4087, 4.99165, 4.00936, 9.40714, 4.98769, 3.99253, 9.41165, 4.99165, 4.99165, 8.42677, 4.99561, -4.98868, 8.4087, 5.05799, -3.7222, -8.54888, 4.98769, -3.99352, 9.41165, 4.99165, -4.01035, 9.40714, 4.99165, -4.99264, 8.42677, 5.05799, 3.09144, -9.15878, 4.99561, 3.99253, -10.539, 4.99561, 4.98769, -9.54505, 1.20608, 0.951591, 11.8535, 4.00936, 4.99165, 9.40714, 4.98769, 4.99561, 8.4087, 3.99253, 4.99561, 9.40488, 4.99561, -4.98868, -9.54505, 4.99561, -3.99352, -10.539, 5.05799, -3.09243, -9.15878, 1.20608, -0.952582, 11.8535, 4.00936, -4.99264, 9.40714, 4.98769, -4.9966, 8.4087, 3.99253, -4.9966, 9.40488, 4.99165, 4.00936, -10.5435, 4.99165, 4.99165, -9.56086, 0.951591, 1.20608, 11.8535, 3.99253, 4.98769, 9.41165, 3.72121, 5.05799, 7.41253, 4.98769, 4.99561, -9.54505, -3.99352, 4.99561, 9.40488, 3.09144, 5.05799, 8.02469, 4.99165, -4.99264, -9.56086, 4.99165, -4.01035, -10.5435, 0.951591, -1.20707, 11.8535, 3.99253, -4.98868, 9.41165, 3.72121, -5.05799, 7.41253, 4.98769, -4.9966, -9.54505, -3.99352, -4.9966, 9.40488, 3.09144, -5.05799, 8.02469, 4.98769, 3.99253, -10.548, 3.08153, 3.08153, -11.2234, 4.00936, 4.99165, -10.5435, -0.952582, 1.20608, 11.8535, -3.99352, 4.98769, 9.41165, 3.72121, 5.05799, -8.54888, 3.99253, 4.99561, -10.539, -4.01035, 4.99165, 9.40714, -3.09243, 5.05799, 8.02469, -3.7222, 5.05799, 7.41253, -4.98868, 4.99561, 8.4087, -4.99264, 4.99165, 8.42677, 4.00936, -4.99264, -10.5435, 3.08153, -3.08252, -11.2234, 4.98769, -3.99352, -10.548, -0.952582, -1.20707, 11.8535, -3.99352, -4.98868, 9.41165, 3.72121, -5.05799, -8.54888, 3.99253, -4.9966, -10.539, -4.01035, -4.99264, 9.40714, -4.99264, -4.99264, 8.42677, -4.98868, -4.9966, 8.4087, -3.7222, -5.05799, 7.41253, -3.09243, -5.05799, 8.02469, 3.1152, 2.99935, -11.2234, 2.99935, 3.1152, -11.2234, 3.99253, 4.98769, -10.548, -1.20707, 0.951591, 11.8535, 3.09144, 5.05799, -9.15878, -3.99352, 4.99561, -10.539, -4.99264, 4.00936, 9.40714, -3.7222, 5.05799, -8.54888, -4.98868, 4.99561, -9.54505, -4.9966, 4.98769, 8.4087, -4.9966, 3.99253, 9.40488, 3.99253, -4.98868, -10.548, 2.99935, -3.11619, -11.2234, 3.1152, -3.00034, -11.2234, -1.20707, -0.952582, 11.8535, 3.09144, -5.05799, -9.15878, -3.99352, -4.9966, -10.539, -4.99264, -4.01035, 9.40714, -4.9966, -3.99352, 9.40488, -4.9966, -4.98868, 8.4087, -4.98868, -4.9966, -9.54505, -3.7222, -5.05799, -8.54888, -3.00034, 3.1152, -11.2234, -3.99352, 4.98769, -10.548, -4.98868, 3.99253, 9.41165, -3.09243, 5.05799, -9.15878, -4.01035, 4.99165, -10.5435, -4.99264, 4.99165, -9.56086, -5.05799, 3.72121, 7.41253, -4.9966, 4.98769, -9.54505, -5.05799, 3.09144, 8.02469, -3.99352, -4.98868, -10.548, -3.00034, -3.11619, -11.2234, -4.98868, -3.99352, 9.41165, -3.09243, -5.05799, -9.15878, -4.01035, -4.99264, -10.5435, -5.05799, -3.09243, 8.02469, -5.05799, -3.7222, 7.41253, -4.9966, -4.98868, -9.54505, -4.99264, -4.99264, -9.56086, -3.08252, 3.08153, -11.2234, -4.99264, 4.00936, -10.5435, -5.05799, 3.72121, -8.54888, -4.9966, 3.99253, -10.539, -3.08252, -3.08252, -11.2234, -4.99264, -4.01035, -10.5435, -5.05799, -3.7222, -8.54888, -4.9966, -3.99352, -10.539, -3.11619, 2.99935, -11.2234, -4.98868, 3.99253, -10.548, -5.05799, 3.09144, -9.15878, -3.11619, -3.00034, -11.2234, -4.98868, -3.99352, -10.548, -5.05799, -3.09243, -9.15878)
|
||||
|
||||
[node name="Thruster Cube" instance=ExtResource("1_48yjx")]
|
||||
script = ExtResource("2_j3sme")
|
||||
|
||||
[node name="TheThrusterCube" parent="." index="0"]
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="." index="1"]
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
|
||||
shape = SubResource("ConvexPolygonShape3D_48yjx")
|
||||
|
||||
[node name="OmniLight3D" type="OmniLight3D" parent="." index="2"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.84073, 4.87805, 10.3575)
|
||||
light_color = Color(1, 0.231373, 0.360784, 1)
|
||||
light_energy = 50.0
|
||||
|
||||
[node name="OmniLight3D2" type="OmniLight3D" parent="." index="3"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.841, 4.878, -8.84974)
|
||||
light_color = Color(1, 0.231373, 0.360784, 1)
|
||||
light_energy = 50.0
|
||||
|
||||
[node name="OmniLight3D3" type="OmniLight3D" parent="." index="4"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.84073, -4.37604, 10.3575)
|
||||
light_color = Color(1, 0.231373, 0.360784, 1)
|
||||
light_energy = 50.0
|
||||
|
||||
[node name="OmniLight3D4" type="OmniLight3D" parent="." index="5"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.841, -4.3761, -8.84974)
|
||||
light_color = Color(1, 0.231373, 0.360784, 1)
|
||||
light_energy = 50.0
|
||||
@@ -0,0 +1,5 @@
|
||||
[gd_scene format=3 uid="uid://bp7um84bpvhmx"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://crfjfbhjuderh" path="res://Assets/Thruster Cube Collision.glb" id="1_v5i77"]
|
||||
|
||||
[node name="Thruster Cube Collision" instance=ExtResource("1_v5i77")]
|
||||
31
Experiments/ThrusterCube/Scripts/thruster_cube.gd
Normal file
31
Experiments/ThrusterCube/Scripts/thruster_cube.gd
Normal file
@@ -0,0 +1,31 @@
|
||||
extends RigidBody3D
|
||||
|
||||
var torque_force: float = 10000.0
|
||||
|
||||
func _physics_process(delta):
|
||||
var local_torque := Vector3.ZERO
|
||||
|
||||
# Pitch
|
||||
if Input.is_action_pressed("w"):
|
||||
local_torque.x -= 1
|
||||
if Input.is_action_pressed("s"):
|
||||
local_torque.x += 1
|
||||
|
||||
# Yaw
|
||||
if Input.is_action_pressed("a"):
|
||||
local_torque.y -= 1
|
||||
if Input.is_action_pressed("d"):
|
||||
local_torque.y += 1
|
||||
|
||||
# Roll
|
||||
if Input.is_action_pressed("q"):
|
||||
local_torque.z += 1
|
||||
if Input.is_action_pressed("e"):
|
||||
local_torque.z -= 1
|
||||
|
||||
# Apply local torque converted to world space
|
||||
if local_torque != Vector3.ZERO:
|
||||
var world_torque = global_transform.basis * local_torque.normalized() * torque_force * delta
|
||||
apply_torque(world_torque)
|
||||
|
||||
print(angular_velocity)
|
||||
1
Experiments/ThrusterCube/Scripts/thruster_cube.gd.uid
Normal file
1
Experiments/ThrusterCube/Scripts/thruster_cube.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dd3ns5mckarbj
|
||||
Reference in New Issue
Block a user