]> Untitled Git - baabarian.git/commitdiff
Added test scene, debug UI, and player
authorClifton Palmer <clifton.james.palmer@protonmail.com>
Fri, 18 Apr 2025 15:06:00 +0000 (18:06 +0300)
committerClifton Palmer <clifton.james.palmer@protonmail.com>
Fri, 18 Apr 2025 16:51:18 +0000 (19:51 +0300)
28 files changed:
.DS_Store [new file with mode: 0644]
Scene.gd [new file with mode: 0644]
Scene.gd.uid [new file with mode: 0644]
cube.tscn [new file with mode: 0644]
main.gd [new file with mode: 0644]
main.gd.uid [new file with mode: 0644]
main.tscn [new file with mode: 0644]
model/.DS_Store [new file with mode: 0644]
model/ram-barbarian.glb [new file with mode: 0644]
model/ram-barbarian.glb.import [new file with mode: 0644]
model/ram-barbarian_ram-body-normals.png [new file with mode: 0644]
model/ram-barbarian_ram-body-normals.png.import [new file with mode: 0644]
model/ram-barbarian_ram-body.png [new file with mode: 0644]
model/ram-barbarian_ram-body.png.import [new file with mode: 0644]
player.gd [new file with mode: 0644]
player.gd.uid [new file with mode: 0644]
player.tscn [new file with mode: 0644]
project.godot
skin.gd [new file with mode: 0644]
skin.gd.uid [new file with mode: 0644]
skin.tscn [new file with mode: 0644]
test.tscn [new file with mode: 0644]
ux/debug_draw_3d.gd [new file with mode: 0644]
ux/debug_draw_3d.gd.uid [new file with mode: 0644]
ux/debug_overlay.gd [new file with mode: 0644]
ux/debug_overlay.gd.uid [new file with mode: 0644]
ux/debug_stats.gd [new file with mode: 0644]
ux/debug_stats.gd.uid [new file with mode: 0644]

diff --git a/.DS_Store b/.DS_Store
new file mode 100644 (file)
index 0000000..28e90a9
Binary files /dev/null and b/.DS_Store differ
diff --git a/Scene.gd b/Scene.gd
new file mode 100644 (file)
index 0000000..a9d57e0
--- /dev/null
+++ b/Scene.gd
@@ -0,0 +1,12 @@
+extends Node3D
+class_name Scene
+
+
+func _input(event: InputEvent) -> void:
+       if event.is_action_pressed("left_click"):
+               Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
+       elif event.is_action_pressed("ui_cancel"):
+               if Input.mouse_mode == Input.MOUSE_MODE_VISIBLE:
+                       get_tree().quit()
+               else:
+                       Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
diff --git a/Scene.gd.uid b/Scene.gd.uid
new file mode 100644 (file)
index 0000000..6e9cc0b
--- /dev/null
@@ -0,0 +1 @@
+uid://dpsqolvx3mdic
diff --git a/cube.tscn b/cube.tscn
new file mode 100644 (file)
index 0000000..0976e80
--- /dev/null
+++ b/cube.tscn
@@ -0,0 +1,9 @@
+[gd_scene load_steps=2 format=3 uid="uid://bx83k2u0snfjc"]
+
+[sub_resource type="BoxMesh" id="BoxMesh_xc3wn"]
+
+[node name="Cube" type="Node3D"]
+
+[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
+transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
+mesh = SubResource("BoxMesh_xc3wn")
diff --git a/main.gd b/main.gd
new file mode 100644 (file)
index 0000000..ae1af4c
--- /dev/null
+++ b/main.gd
@@ -0,0 +1,41 @@
+extends Node
+class_name MainMenu
+
+
+@export var scene: PackedScene
+@export var fullscreen: bool = true
+@export var screen_size_fractional: float = 0.5
+
+
+func _ready() -> void:
+       _set_project_version()
+       _set_screen_size()
+
+
+func _set_project_version() -> void:
+       var version = ProjectSettings.get_setting("application/config/version")
+       %buildVersion.text = "v" + str(version)
+
+
+func _set_screen_size() -> void:
+       var _screen_size: Vector2i = DisplayServer.screen_get_size()
+       if fullscreen:
+               DisplayServer.window_set_position(Vector2i.ZERO)
+               DisplayServer.window_set_size(_screen_size)
+       else:
+               var _win_pos = _screen_size * (1.0 - screen_size_fractional) * 0.5
+               var _win_size = _screen_size * screen_size_fractional
+               DisplayServer.window_set_position(_win_pos)
+               DisplayServer.window_set_size(_win_size)
+
+
+func _input(event: InputEvent) -> void:
+       if event.is_action_pressed("ui_cancel"):
+               get_tree().quit()
+
+
+func _on_start_pressed() -> void:
+       if scene:
+               get_tree().change_scene_to_packed(scene)
+       else:
+               print_debug("No scene to change to!")
diff --git a/main.gd.uid b/main.gd.uid
new file mode 100644 (file)
index 0000000..9c90190
--- /dev/null
@@ -0,0 +1 @@
+uid://clsgi3l4v8a6w
diff --git a/main.tscn b/main.tscn
new file mode 100644 (file)
index 0000000..361cc01
--- /dev/null
+++ b/main.tscn
@@ -0,0 +1,79 @@
+[gd_scene load_steps=3 format=3 uid="uid://cbbg1tc2xqrj4"]
+
+[ext_resource type="Script" uid="uid://clsgi3l4v8a6w" path="res://main.gd" id="1_ig7tw"]
+[ext_resource type="PackedScene" uid="uid://c1bxy5s8fvheq" path="res://test.tscn" id="2_0xm2m"]
+
+[node name="Main" type="Node"]
+script = ExtResource("1_ig7tw")
+scene = ExtResource("2_0xm2m")
+fullscreen = false
+screen_size_fractional = 0.7
+
+[node name="menu" type="Control" parent="."]
+layout_mode = 3
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+size_flags_horizontal = 3
+size_flags_vertical = 3
+
+[node name="background" type="ColorRect" parent="menu"]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+color = Color(0.0383972, 0.0383972, 0.0383972, 1)
+
+[node name="start" type="MarginContainer" parent="menu"]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+size_flags_horizontal = 3
+size_flags_vertical = 3
+theme_override_constants/margin_left = 100
+theme_override_constants/margin_top = 100
+theme_override_constants/margin_right = 100
+theme_override_constants/margin_bottom = 100
+
+[node name="VBoxContainer" type="VBoxContainer" parent="menu/start"]
+layout_mode = 2
+
+[node name="Start" type="MenuButton" parent="menu/start/VBoxContainer"]
+layout_mode = 2
+theme_override_font_sizes/font_size = 50
+text = "start the intro"
+
+[node name="MarginContainer" type="MarginContainer" parent="menu/start/VBoxContainer"]
+layout_mode = 2
+size_flags_horizontal = 4
+size_flags_vertical = 3
+theme_override_constants/margin_left = 30
+theme_override_constants/margin_top = 30
+theme_override_constants/margin_right = 30
+theme_override_constants/margin_bottom = 30
+
+[node name="Label" type="Label" parent="menu/start/VBoxContainer/MarginContainer"]
+layout_mode = 2
+theme_override_font_sizes/font_size = 30
+text = "Controls
+
+e - forward
+d - back
+s - left
+f - right
+
+space/click - action"
+
+[node name="buildVersion" type="Label" parent="menu/start/VBoxContainer"]
+unique_name_in_owner = true
+layout_mode = 2
+text = "0.1.0"
+
+[connection signal="pressed" from="menu/start/VBoxContainer/Start" to="." method="_on_start_pressed"]
diff --git a/model/.DS_Store b/model/.DS_Store
new file mode 100644 (file)
index 0000000..5008ddf
Binary files /dev/null and b/model/.DS_Store differ
diff --git a/model/ram-barbarian.glb b/model/ram-barbarian.glb
new file mode 100644 (file)
index 0000000..54bc529
Binary files /dev/null and b/model/ram-barbarian.glb differ
diff --git a/model/ram-barbarian.glb.import b/model/ram-barbarian.glb.import
new file mode 100644 (file)
index 0000000..13f9456
--- /dev/null
@@ -0,0 +1,37 @@
+[remap]
+
+importer="scene"
+importer_version=1
+type="PackedScene"
+uid="uid://b77p7nmn30107"
+path="res://.godot/imported/ram-barbarian.glb-07b3a0eb6f172a781c3a26c2990ebf02.scn"
+
+[deps]
+
+source_file="res://model/ram-barbarian.glb"
+dest_files=["res://.godot/imported/ram-barbarian.glb-07b3a0eb6f172a781c3a26c2990ebf02.scn"]
+
+[params]
+
+nodes/root_type=""
+nodes/root_name=""
+nodes/apply_root_scale=true
+nodes/root_scale=1.0
+nodes/import_as_skeleton_bones=false
+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=""
+_subresources={}
+gltf/naming_version=1
+gltf/embedded_image_handling=1
diff --git a/model/ram-barbarian_ram-body-normals.png b/model/ram-barbarian_ram-body-normals.png
new file mode 100644 (file)
index 0000000..b3e94d7
Binary files /dev/null and b/model/ram-barbarian_ram-body-normals.png differ
diff --git a/model/ram-barbarian_ram-body-normals.png.import b/model/ram-barbarian_ram-body-normals.png.import
new file mode 100644 (file)
index 0000000..33be3d8
--- /dev/null
@@ -0,0 +1,38 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://crtv7bbknatyu"
+path.s3tc="res://.godot/imported/ram-barbarian_ram-body-normals.png-548bc1464bcc21508a51336d56149a2d.s3tc.ctex"
+metadata={
+"imported_formats": ["s3tc_bptc"],
+"vram_texture": true
+}
+generator_parameters={
+"md5": "4125e37bc8274fc6ba0be7f31c51836d"
+}
+
+[deps]
+
+source_file="res://model/ram-barbarian_ram-body-normals.png"
+dest_files=["res://.godot/imported/ram-barbarian_ram-body-normals.png-548bc1464bcc21508a51336d56149a2d.s3tc.ctex"]
+
+[params]
+
+compress/mode=2
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=1
+compress/channel_pack=0
+mipmaps/generate=true
+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=0
diff --git a/model/ram-barbarian_ram-body.png b/model/ram-barbarian_ram-body.png
new file mode 100644 (file)
index 0000000..d337ec4
Binary files /dev/null and b/model/ram-barbarian_ram-body.png differ
diff --git a/model/ram-barbarian_ram-body.png.import b/model/ram-barbarian_ram-body.png.import
new file mode 100644 (file)
index 0000000..48576b6
--- /dev/null
@@ -0,0 +1,38 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://dl1aywh8g4337"
+path.s3tc="res://.godot/imported/ram-barbarian_ram-body.png-73d4619c984cf1c10dc2b9e25a1ff76f.s3tc.ctex"
+metadata={
+"imported_formats": ["s3tc_bptc"],
+"vram_texture": true
+}
+generator_parameters={
+"md5": "25fa9f80e976e5f514b9953919c77c97"
+}
+
+[deps]
+
+source_file="res://model/ram-barbarian_ram-body.png"
+dest_files=["res://.godot/imported/ram-barbarian_ram-body.png-73d4619c984cf1c10dc2b9e25a1ff76f.s3tc.ctex"]
+
+[params]
+
+compress/mode=2
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=true
+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=0
diff --git a/player.gd b/player.gd
new file mode 100644 (file)
index 0000000..332ffcd
--- /dev/null
+++ b/player.gd
@@ -0,0 +1,128 @@
+extends CharacterBody3D
+class_name Player
+
+
+# player settings
+@export_group("Movement")
+@export var walk_speed := 3.0
+@export var jog_speed := 6.0
+@export var charge_speed := 20
+
+@export var air_speed := 3.0
+@export var acceleration := 30.0
+@export var jump_speed := 6.0
+@export var rotation_speed := 10.0
+@export var fall_speed := 1.2
+@export var idle_timeout := 5.0
+@export var hard_landing_limit := 10.0
+
+@export_group("Camera")
+@export_range(1.0, 10.0) var camera_distance := 2.0
+@export_range(0.0, 1.0) var mouse_sensitivity := 0.15
+@export_range(0.0, 1.0) var mouse_sensitivity_x := 1.0
+@export_range(0.0, 1.0) var mouse_sensitivity_y := 0.5
+@export_range(0.0, 10.0) var joystick_sensitivity_x := 4.0
+@export_range(0.0, 10.0) var joystick_sensitivity_y := 2.0
+
+
+@onready var _debug: CanvasLayer = %debug
+@onready var _camera_pivot: Node3D = %camera_pivot
+@onready var _camera: Camera3D = %camera
+@onready var _skin: AnimatedSkin = %skin
+
+var _last_movement_direction := rotation
+var _camera_input_direction := Vector2.ZERO
+
+enum {CAMERA_MOUSE_INPUT, CAMERA_JOYSTICK_INPUT}
+var _camera_input_method := CAMERA_MOUSE_INPUT
+
+var _idle_time: float = 0.0
+var _player_speed: float = walk_speed
+
+
+func _ready() -> void:
+       _debug.draw.add_vector(self, "velocity", 1, 1, Color(0,1,0,1))
+       _debug.draw.add_vector(self, "_last_movement_direction", 1, 1, Color(1,0,0,1))
+       _debug.stats.add_property(self, "velocity", "length")
+       _debug.stats.add_property(self, "_idle_time", "round")
+
+
+func _physics_process(delta: float) -> void:
+       _process_camera(delta)
+       _process_player(delta)
+
+
+func _unhandled_input(event: InputEvent) -> void:
+       # If user clicks on the window, capture the mouse and direct the camera with it
+       if Input.get_mouse_mode() != Input.MOUSE_MODE_CAPTURED:
+               return
+
+                       #_camera_input_direction *= mouse_sensitivity
+       if event is InputEventMouseMotion:
+               _camera_input_method = CAMERA_MOUSE_INPUT
+               _camera_input_direction = event.screen_relative * mouse_sensitivity
+       elif event is InputEventJoypadMotion:
+               _camera_input_method = CAMERA_JOYSTICK_INPUT
+               _camera_input_direction = Input.get_vector("camera-left", "camera-right", "camera-up", "camera-down")
+               _camera_input_direction *= Vector2(joystick_sensitivity_x, -joystick_sensitivity_y)
+
+
+func _input(event: InputEvent):
+       if event.is_action_pressed("player_run"):
+               _player_speed = jog_speed
+       elif event.is_action_released("player_run"):
+               _player_speed = walk_speed
+       
+       if event.is_action_pressed("player_attack") and velocity.length() > jog_speed * .75:
+               _player_speed = charge_speed
+
+
+# Get the XZ input direction based on player's input relative to the camera
+func _get_player_move_direction() -> Vector3:
+       var input_dir := Input.get_vector("player_left", "player_right", "player_forward", "player_backward")
+       var forward := _camera.global_basis.z
+       var right := _camera.global_basis.x
+       var move_direction := (forward * input_dir.y + right * input_dir.x).normalized()
+       move_direction.y = 0
+       return move_direction
+
+
+func _process_camera(delta: float) -> void:
+       # vertical camera rotation
+       _camera_pivot.rotation.x += _camera_input_direction.y * mouse_sensitivity_y * delta
+       _camera_pivot.rotation.x = clamp(_camera_pivot.rotation.x, -PI / 6, PI / 3)
+
+       # horizontal camera rotation
+       _camera_pivot.rotation.y -= _camera_input_direction.x * mouse_sensitivity_x * delta
+
+       # reset mouse movement vector if mouse input
+       if _camera_input_method == CAMERA_MOUSE_INPUT:
+               _camera_input_direction = Vector2.ZERO
+
+
+func _process_player(delta: float) -> void:
+       var move_direction := _get_player_move_direction()
+       
+       # if we're not stuck, then it's okay to set the velocity
+       velocity = velocity.move_toward(move_direction * _player_speed, acceleration * delta)
+       var movement_speed := Vector3(velocity.x, 0, velocity.z).length()
+       
+       # also, if we're moving, we're not idle
+       if move_direction.length() < 0.2:
+               if velocity == Vector3.ZERO:
+                       _idle_time += delta
+       else:
+               _last_movement_direction = move_direction
+               _idle_time = 0.0
+
+       # if camera is unlocked, rotate whole skin to face movement direction
+       # else, rotate to face camera pivot global Y direction
+       var skin_target_angle := Vector3.BACK.signed_angle_to(_last_movement_direction, Vector3.UP)
+       _skin.global_rotation.y = lerp_angle(
+               _skin.global_rotation.y,
+               skin_target_angle,
+               rotation_speed * delta
+               )
+       _skin.set_movement_speed(movement_speed)
+
+       move_and_slide()
diff --git a/player.gd.uid b/player.gd.uid
new file mode 100644 (file)
index 0000000..3dbf65c
--- /dev/null
@@ -0,0 +1 @@
+uid://b3hff6ctx5cgj
diff --git a/player.tscn b/player.tscn
new file mode 100644 (file)
index 0000000..96cda06
--- /dev/null
@@ -0,0 +1,28 @@
+[gd_scene load_steps=4 format=3 uid="uid://ch6s2gvhi64uh"]
+
+[ext_resource type="PackedScene" uid="uid://127fi2uta0p8" path="res://skin.tscn" id="1_4flbx"]
+[ext_resource type="Script" uid="uid://b3hff6ctx5cgj" path="res://player.gd" id="1_onrkg"]
+
+[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_sh265"]
+radius = 0.602678
+
+[node name="player" type="CharacterBody3D"]
+script = ExtResource("1_onrkg")
+
+[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
+transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
+shape = SubResource("CapsuleShape3D_sh265")
+
+[node name="skin" parent="." instance=ExtResource("1_4flbx")]
+unique_name_in_owner = true
+transform = Transform3D(0.688, 0, 0, 0, 0.688, 0, 0, 0, 0.688, 0, 0, 0)
+
+[node name="camera_pivot" type="Node3D" parent="."]
+unique_name_in_owner = true
+
+[node name="SpringArm3D" type="SpringArm3D" parent="camera_pivot"]
+transform = Transform3D(-1, 0, -8.74228e-08, -2.43198e-08, 0.960527, 0.278187, 8.39719e-08, 0.278187, -0.960527, 0, 2.12611, 0)
+spring_length = 3.0
+
+[node name="camera" type="Camera3D" parent="camera_pivot/SpringArm3D"]
+unique_name_in_owner = true
index 675d4d5a8b0501658b3db8a6551b4c7e93e30cea..2ce3c042fe578abe192ef8c797d8319446ff77a2 100644 (file)
@@ -11,5 +11,49 @@ config_version=5
 [application]
 
 config/name="baabarian"
+config/version="0.0.0"
+run/main_scene="uid://cbbg1tc2xqrj4"
 config/features=PackedStringArray("4.4", "Forward Plus")
 config/icon="res://icon.svg"
+
+[display]
+
+window/stretch/mode="canvas_items"
+
+[input]
+
+player_forward={
+"deadzone": 0.2,
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":69,"key_label":0,"unicode":101,"location":0,"echo":false,"script":null)
+]
+}
+player_backward={
+"deadzone": 0.2,
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
+]
+}
+player_left={
+"deadzone": 0.2,
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
+]
+}
+player_right={
+"deadzone": 0.2,
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":70,"key_label":0,"unicode":102,"location":0,"echo":false,"script":null)
+]
+}
+player_attack={
+"deadzone": 0.2,
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
+]
+}
+left_click={
+"deadzone": 0.2,
+"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(591, 40),"global_position":Vector2(610, 136),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null)
+]
+}
+player_run={
+"deadzone": 0.2,
+"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
+]
+}
diff --git a/skin.gd b/skin.gd
new file mode 100644 (file)
index 0000000..f28c089
--- /dev/null
+++ b/skin.gd
@@ -0,0 +1,17 @@
+extends Node3D
+class_name AnimatedSkin
+
+
+@onready var _tree: AnimationTree = %AnimationTree
+
+
+func set_movement_speed(speed: float):
+       _tree.set("parameters/movement/blend_position", speed)
+
+
+func set_motion_forward():
+       _tree.set("parameters/motion/transition_request", "move")
+
+
+func set_motion_idle():
+       _tree.set("parameters/motion/transition_request", "idle")
diff --git a/skin.gd.uid b/skin.gd.uid
new file mode 100644 (file)
index 0000000..0575542
--- /dev/null
@@ -0,0 +1 @@
+uid://b2hbg1leabjky
diff --git a/skin.tscn b/skin.tscn
new file mode 100644 (file)
index 0000000..9e83834
--- /dev/null
+++ b/skin.tscn
@@ -0,0 +1,351 @@
+[gd_scene load_steps=12 format=3 uid="uid://127fi2uta0p8"]
+
+[ext_resource type="PackedScene" uid="uid://b77p7nmn30107" path="res://model/ram-barbarian.glb" id="1_slxxm"]
+[ext_resource type="Script" uid="uid://b2hbg1leabjky" path="res://skin.gd" id="2_0vn8v"]
+
+[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_0vn8v"]
+animation = &"idle-standing"
+
+[sub_resource type="AnimationNodeTransition" id="AnimationNodeTransition_slxxm"]
+sync = true
+xfade_time = 0.5
+input_0/name = "idle"
+input_0/auto_advance = false
+input_0/break_loop_at_end = false
+input_0/reset = true
+input_1/name = "move"
+input_1/auto_advance = false
+input_1/break_loop_at_end = false
+input_1/reset = true
+
+[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ogs51"]
+animation = &"idle-standing"
+
+[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_5n2vx"]
+animation = &"move-walk"
+
+[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_slxxm"]
+animation = &"move-jog"
+
+[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_lkge1"]
+animation = &"move-run"
+
+[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_2kaph"]
+animation = &"move-charge"
+
+[sub_resource type="AnimationNodeBlendSpace1D" id="AnimationNodeBlendSpace1D_lkge1"]
+blend_point_0/node = SubResource("AnimationNodeAnimation_ogs51")
+blend_point_0/pos = 0.0
+blend_point_1/node = SubResource("AnimationNodeAnimation_5n2vx")
+blend_point_1/pos = 3.0
+blend_point_2/node = SubResource("AnimationNodeAnimation_slxxm")
+blend_point_2/pos = 6.0
+blend_point_3/node = SubResource("AnimationNodeAnimation_lkge1")
+blend_point_3/pos = 15.0
+blend_point_4/node = SubResource("AnimationNodeAnimation_2kaph")
+blend_point_4/pos = 20.0
+min_space = 0.0
+max_space = 20.0
+sync = true
+
+[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_slxxm"]
+graph_offset = Vector2(-636.716, -80.3395)
+nodes/idle/node = SubResource("AnimationNodeAnimation_0vn8v")
+nodes/idle/position = Vector2(-320, -40)
+nodes/motion/node = SubResource("AnimationNodeTransition_slxxm")
+nodes/motion/position = Vector2(-30, 90)
+nodes/movement/node = SubResource("AnimationNodeBlendSpace1D_lkge1")
+nodes/movement/position = Vector2(-320, 180)
+nodes/output/position = Vector2(260, 100)
+node_connections = [&"motion", 0, &"idle", &"motion", 1, &"movement", &"output", 0, &"motion"]
+
+[node name="skin" instance=ExtResource("1_slxxm")]
+script = ExtResource("2_0vn8v")
+
+[node name="AnimationTree" type="AnimationTree" parent="." index="0"]
+unique_name_in_owner = true
+root_node = NodePath("%AnimationTree/..")
+tree_root = SubResource("AnimationNodeBlendTree_slxxm")
+anim_player = NodePath("../AnimationPlayer")
+parameters/motion/current_state = "move"
+parameters/motion/transition_request = ""
+parameters/motion/current_index = 1
+parameters/movement/blend_position = 0.0
+
+[node name="Skeleton3D" parent="." index="1"]
+bones/0/position = Vector3(0.00217866, 2.36614, 0.207771)
+bones/0/rotation = Quaternion(0.173451, -0.0217286, -0.0349716, 0.983982)
+bones/2/position = Vector3(-0.00033081, 1.04773, -0.167883)
+bones/2/rotation = Quaternion(0.203866, -0.0143156, -0.00295468, 0.97889)
+bones/3/rotation = Quaternion(-0.0515642, -1.19138e-07, -9.52299e-09, 0.99867)
+bones/3/scale = Vector3(1, 1, 1)
+bones/4/rotation = Quaternion(-0.107927, 0.00433947, 0.00533881, 0.994135)
+bones/4/scale = Vector3(1, 1, 1)
+bones/5/rotation = Quaternion(0.0513819, 0.00970749, 0.00897262, 0.998592)
+bones/5/scale = Vector3(0.999999, 1, 0.999999)
+bones/6/rotation = Quaternion(0.207477, 0.00434387, -0.0370628, 0.977528)
+bones/7/rotation = Quaternion(-0.0948569, 0.00300923, -0.000286785, 0.995486)
+bones/8/rotation = Quaternion(-0.0351983, -0.0391799, -0.00324711, 0.998607)
+bones/9/position = Vector3(-0.00292446, 1.02887, -0.0793991)
+bones/9/rotation = Quaternion(-0.0156798, -0.737123, -0.411571, 0.535736)
+bones/10/position = Vector3(-0.00292441, 1.02887, -0.0793992)
+bones/10/rotation = Quaternion(-0.0181458, 0.722621, 0.404749, 0.560061)
+bones/11/position = Vector3(-0.0133461, 0.91629, 0.2602)
+bones/11/rotation = Quaternion(0.97634, -0.00872798, 0.0118799, 0.215736)
+bones/11/scale = Vector3(0.999999, 0.999999, 1)
+bones/12/position = Vector3(0.229423, 1.01393, -0.0599366)
+bones/12/rotation = Quaternion(0.964887, 0.167957, 0.0245226, 0.200455)
+bones/12/scale = Vector3(1.01325, 0.974025, 1.01325)
+bones/13/rotation = Quaternion(-2.16179e-08, -0.0630815, 9.66979e-09, 0.998008)
+bones/14/rotation = Quaternion(0.517933, -0.0623744, 0.0380681, 0.852294)
+bones/14/scale = Vector3(1.00262, 0.964567, 1.03457)
+bones/15/rotation = Quaternion(-8.04483e-09, 0.00452582, 8.19296e-09, 0.99999)
+bones/16/rotation = Quaternion(-0.766151, 0.00448979, 0.113278, 0.632583)
+bones/16/scale = Vector3(0.98527, 0.986272, 1.02933)
+bones/17/rotation = Quaternion(-0.000131442, 0.977292, -0.211898, -0.000613969)
+bones/17/scale = Vector3(0.999998, 1, 0.999998)
+bones/18/position = Vector3(-0.236267, 1.01935, -0.0724381)
+bones/18/rotation = Quaternion(0.965212, -0.144677, 0.00172298, 0.217789)
+bones/18/scale = Vector3(1.01557, 0.96958, 1.01557)
+bones/19/rotation = Quaternion(-2.91454e-08, 0.059961, -1.0754e-08, 0.998201)
+bones/20/rotation = Quaternion(0.514466, 0.0595643, -0.0360275, 0.854681)
+bones/20/scale = Vector3(1.00261, 0.959745, 1.04)
+bones/21/rotation = Quaternion(9.05591e-08, 0.0124282, -3.86341e-08, 0.999923)
+bones/22/rotation = Quaternion(-0.752824, 0.011618, -0.141228, 0.642787)
+bones/22/scale = Vector3(0.984327, 0.983737, 1.03312)
+bones/23/rotation = Quaternion(-0.000141056, 0.97525, -0.221103, -0.000612969)
+bones/23/scale = Vector3(0.999997, 1, 0.999998)
+bones/24/position = Vector3(0.136808, 2.43218, 0.345526)
+bones/24/rotation = Quaternion(0.193777, -0.111132, -0.141594, 0.964392)
+bones/25/position = Vector3(0.150228, 2.4838, 0.369167)
+bones/25/rotation = Quaternion(-0.355347, 0.0445519, -0.43567, 0.825794)
+bones/26/position = Vector3(0.183223, 2.50144, 0.339154)
+bones/26/rotation = Quaternion(0.746099, -0.120927, 0.646624, -0.102912)
+bones/26/scale = Vector3(0.999998, 1.00001, 0.999995)
+bones/28/position = Vector3(0.147886, 2.40209, 0.341157)
+bones/28/rotation = Quaternion(0.135945, -0.415178, 0.128898, 0.890243)
+bones/29/position = Vector3(-0.129019, 2.45253, 0.337329)
+bones/29/rotation = Quaternion(0.197269, 0.0664198, 0.0734082, 0.975338)
+bones/30/position = Vector3(-0.135812, 2.50571, 0.360376)
+bones/30/rotation = Quaternion(-0.370889, -0.0425602, 0.360251, 0.854897)
+bones/31/position = Vector3(-0.163876, 2.52802, 0.328465)
+bones/31/rotation = Quaternion(0.772609, 0.066696, -0.613721, -0.148234)
+bones/33/position = Vector3(-0.144259, 2.42446, 0.332147)
+bones/33/rotation = Quaternion(0.171136, 0.376122, -0.192276, 0.890098)
+bones/34/position = Vector3(-0.00974592, 2.32479, 0.492662)
+bones/34/rotation = Quaternion(-0.573132, 0.00936423, -0.0400931, 0.818428)
+bones/35/position = Vector3(-0.0108095, 2.33731, 0.558488)
+bones/35/rotation = Quaternion(-0.727104, 0.0172954, -0.0373632, 0.685291)
+bones/36/rotation = Quaternion(0.172857, -8.96689e-08, 5.17381e-07, 0.984947)
+bones/36/scale = Vector3(1.00001, 0.99999, 1)
+bones/37/position = Vector3(0.0171475, 2.34917, 0.512179)
+bones/37/rotation = Quaternion(-0.075461, 0.56548, 0.775492, 0.270462)
+bones/38/position = Vector3(-0.0337554, 2.35307, 0.510614)
+bones/38/rotation = Quaternion(0.0946329, 0.566085, 0.795827, -0.193008)
+bones/39/position = Vector3(0.0741976, 2.43565, 0.482216)
+bones/39/rotation = Quaternion(0.00936417, 0.573132, 0.818428, 0.040093)
+bones/40/position = Vector3(0.0353571, 2.42136, 0.507073)
+bones/40/rotation = Quaternion(0.751746, 0.520607, 0.327904, -0.237332)
+bones/40/scale = Vector3(0.999991, 1.00002, 0.999991)
+bones/41/rotation = Quaternion(0.0748443, -0.0181031, -0.0431399, 0.996097)
+bones/41/scale = Vector3(1.00002, 0.999968, 1.00002)
+bones/42/rotation = Quaternion(0.274345, -0.0136419, -0.129806, 0.952732)
+bones/42/scale = Vector3(0.999996, 1, 1)
+bones/43/rotation = Quaternion(0.27804, -0.00341172, 0.0671248, 0.958215)
+bones/43/scale = Vector3(0.999993, 1.00001, 0.999995)
+bones/44/position = Vector3(0.110621, 2.43323, 0.48486)
+bones/44/rotation = Quaternion(-0.603265, 0.641298, 0.348676, -0.3213)
+bones/44/scale = Vector3(0.999998, 1, 0.999998)
+bones/45/rotation = Quaternion(0.2161, 2.22311e-06, 4.32705e-05, 0.976371)
+bones/45/scale = Vector3(1, 0.999993, 1)
+bones/46/rotation = Quaternion(0.356977, 0.00869095, -0.115439, 0.926912)
+bones/46/scale = Vector3(1.00001, 0.99998, 1.00001)
+bones/47/rotation = Quaternion(0.0323413, 0.0279362, -0.125436, 0.991181)
+bones/47/scale = Vector3(0.999984, 1.00003, 0.999982)
+bones/48/position = Vector3(0.0741976, 2.43565, 0.482216)
+bones/48/rotation = Quaternion(0.00936423, 0.573133, 0.818428, 0.040093)
+bones/50/position = Vector3(-0.0750406, 2.44709, 0.477629)
+bones/50/rotation = Quaternion(0.00936417, 0.573132, 0.818428, 0.040093)
+bones/51/position = Vector3(-0.0404188, 2.42717, 0.504744)
+bones/51/rotation = Quaternion(0.7195, -0.56896, -0.285642, -0.277514)
+bones/51/scale = Vector3(0.999994, 1.00001, 0.999994)
+bones/52/rotation = Quaternion(0.0748532, 0.0181026, 0.0431495, 0.996096)
+bones/52/scale = Vector3(1.00001, 0.999982, 1.00001)
+bones/53/rotation = Quaternion(0.274339, 0.013641, 0.129806, 0.952734)
+bones/53/scale = Vector3(0.999994, 1.00001, 0.999996)
+bones/54/rotation = Quaternion(0.278045, 0.00341402, -0.0671337, 0.958213)
+bones/54/scale = Vector3(1.00001, 0.999981, 1.00001)
+bones/55/position = Vector3(-0.111501, 2.45025, 0.478034)
+bones/55/rotation = Quaternion(0.639518, 0.583207, 0.341444, 0.366474)
+bones/55/scale = Vector3(0.999997, 1.00001, 0.999997)
+bones/56/rotation = Quaternion(0.216103, -7.73366e-06, -1.78721e-05, 0.976371)
+bones/56/scale = Vector3(1.00001, 0.999986, 1.00001)
+bones/57/rotation = Quaternion(0.356974, -0.00869836, 0.115457, 0.926911)
+bones/57/scale = Vector3(0.999996, 1, 1)
+bones/58/rotation = Quaternion(0.0323403, -0.0279344, 0.125375, 0.991189)
+bones/58/scale = Vector3(1.00001, 0.999986, 1.00001)
+bones/59/position = Vector3(-0.0750406, 2.44709, 0.477629)
+bones/59/rotation = Quaternion(0.00936412, 0.573133, 0.818428, 0.0400931)
+bones/61/position = Vector3(-0.0120677, 2.28434, 0.467379)
+bones/61/rotation = Quaternion(-0.573132, 0.00936423, -0.040093, 0.818428)
+bones/62/position = Vector3(-0.0104246, 2.29889, 0.450175)
+bones/62/rotation = Quaternion(-0.480772, 0.00495065, -0.0408734, 0.875879)
+bones/65/position = Vector3(0.00242506, 2.44256, 0.390263)
+bones/65/rotation = Quaternion(0.992126, -0.0397584, 0.0106962, 0.118282)
+bones/66/position = Vector3(-0.0166653, 2.2154, 0.445092)
+bones/66/rotation = Quaternion(0.349647, -0.0277307, -0.0304327, 0.935977)
+bones/66/scale = Vector3(0.999995, 1.00001, 0.999995)
+bones/67/scale = Vector3(1.00001, 0.999973, 1.00001)
+bones/68/position = Vector3(-0.0116753, 2.25009, 0.369232)
+bones/68/rotation = Quaternion(0.84115, -0.0404421, -0.00771911, 0.539232)
+bones/69/position = Vector3(0.136334, 2.4323, 0.394378)
+bones/69/rotation = Quaternion(0.982878, -0.125364, -0.00397405, -0.134978)
+bones/72/position = Vector3(-0.131484, 2.45282, 0.386148)
+bones/72/rotation = Quaternion(0.988997, 0.0540205, 0.0443724, -0.130377)
+bones/75/position = Vector3(-0.011535, 2.30772, 0.508326)
+bones/75/rotation = Quaternion(-0.446553, -0.340157, -0.527392, 0.637763)
+bones/76/rotation = Quaternion(-0.152114, -0.0958311, 0.26607, 0.94704)
+bones/76/scale = Vector3(0.999995, 1.00001, 0.999996)
+bones/77/position = Vector3(-0.011535, 2.30772, 0.508326)
+bones/77/rotation = Quaternion(-0.435218, 0.353569, 0.463227, 0.686291)
+bones/78/rotation = Quaternion(-0.152099, 0.0958265, -0.266074, 0.947042)
+bones/78/scale = Vector3(0.999996, 1.00001, 0.999997)
+bones/79/position = Vector3(-0.0126331, 2.2878, 0.494408)
+bones/79/rotation = Quaternion(-0.384009, -0.331765, -0.455133, 0.731657)
+bones/79/scale = Vector3(0.999996, 1.00001, 0.999996)
+bones/80/rotation = Quaternion(-0.0082481, 0.0772324, 0.0388616, 0.996221)
+bones/80/scale = Vector3(1.00001, 0.999983, 1.00001)
+bones/81/position = Vector3(-0.0126331, 2.2878, 0.494408)
+bones/81/rotation = Quaternion(-0.371312, 0.337554, 0.385955, 0.774095)
+bones/82/rotation = Quaternion(-0.00824437, -0.0772325, -0.0388543, 0.996222)
+bones/82/scale = Vector3(1.00001, 0.999978, 1.00001)
+bones/83/position = Vector3(0.114445, 2.44197, 0.491183)
+bones/83/rotation = Quaternion(0.206696, 0.439216, 0.618364, 0.618055)
+bones/83/scale = Vector3(0.999998, 1, 0.999998)
+bones/84/rotation = Quaternion(-0.223152, -3.36832e-06, 0.0151671, 0.974666)
+bones/84/scale = Vector3(1, 1, 0.999999)
+bones/85/rotation = Quaternion(-0.299471, 2.72422e-06, -0.0939843, 0.949465)
+bones/86/rotation = Quaternion(-0.172955, -4.25693e-07, 0.173112, 0.969597)
+bones/86/scale = Vector3(0.999992, 1.00002, 0.999992)
+bones/87/position = Vector3(0.03012, 2.43088, 0.506965)
+bones/87/rotation = Quaternion(-0.380683, 0.0697822, 0.91147, 0.139401)
+bones/87/scale = Vector3(1, 0.999998, 1)
+bones/88/scale = Vector3(1, 0.999995, 1)
+bones/89/position = Vector3(-0.114329, 2.4595, 0.484152)
+bones/89/rotation = Quaternion(0.191398, -0.472434, -0.65714, 0.555283)
+bones/89/scale = Vector3(0.999995, 1.00001, 0.999995)
+bones/90/rotation = Quaternion(-0.223173, -2.162e-06, -0.0151925, 0.97466)
+bones/90/scale = Vector3(1.00001, 0.999989, 1)
+bones/91/rotation = Quaternion(-0.299462, -6.08687e-08, 0.0939902, 0.949467)
+bones/92/rotation = Quaternion(-0.172932, -3.16152e-07, -0.173093, 0.969605)
+bones/92/scale = Vector3(1.00001, 0.999989, 1.00001)
+bones/93/position = Vector3(-0.0337979, 2.43577, 0.505)
+bones/93/rotation = Quaternion(0.356804, 0.0447444, 0.930685, -0.0671915)
+bones/93/scale = Vector3(0.999998, 1, 0.999998)
+bones/94/scale = Vector3(1, 0.999994, 1)
+bones/95/position = Vector3(0.12372, 2.43558, 0.443512)
+bones/95/rotation = Quaternion(0.490255, -0.31923, -0.174153, 0.792094)
+bones/96/position = Vector3(0.121557, 2.46231, 0.495251)
+bones/96/rotation = Quaternion(0.659746, -0.456137, 0.121916, 0.584646)
+bones/97/rotation = Quaternion(0.295784, -1.33077e-06, 0.145409, 0.944123)
+bones/98/position = Vector3(0.0297907, 2.44998, 0.536888)
+bones/98/rotation = Quaternion(0.726315, -0.483273, 0.471437, 0.129077)
+bones/99/position = Vector3(-0.12154, 2.45437, 0.435975)
+bones/99/rotation = Quaternion(0.507635, 0.25645, 0.128094, 0.812485)
+bones/100/position = Vector3(-0.118497, 2.4807, 0.487873)
+bones/100/rotation = Quaternion(0.696076, 0.386304, -0.14594, 0.587324)
+bones/102/position = Vector3(-0.0323919, 2.45475, 0.534977)
+bones/102/rotation = Quaternion(0.775196, 0.422219, -0.457449, 0.107442)
+bones/103/position = Vector3(0.0405015, 2.30549, 0.47718)
+bones/103/rotation = Quaternion(-0.35273, -0.246954, -0.391763, 0.813091)
+bones/105/position = Vector3(-0.0613044, 2.31329, 0.474052)
+bones/105/rotation = Quaternion(-0.344674, 0.248147, 0.317542, 0.847815)
+bones/107/position = Vector3(0.12372, 2.43558, 0.443512)
+bones/107/rotation = Quaternion(0.795722, -0.366868, -0.472797, 0.093265)
+bones/109/position = Vector3(-0.12154, 2.45437, 0.435975)
+bones/109/rotation = Quaternion(0.806556, 0.302009, 0.488444, 0.14029)
+bones/111/position = Vector3(0.0297342, 2.53757, 0.534432)
+bones/111/rotation = Quaternion(0.705799, 0.0101586, 0.708274, 0.00966742)
+bones/112/position = Vector3(0.0763732, 2.54864, 0.51783)
+bones/112/rotation = Quaternion(0.788377, 0.0791014, 0.610011, 0.00952507)
+bones/113/position = Vector3(0.112597, 2.55222, 0.485077)
+bones/113/rotation = Quaternion(0.927383, 0.0665714, 0.366569, 0.034011)
+bones/114/position = Vector3(-0.018855, 2.54129, 0.532939)
+bones/114/rotation = Quaternion(0.724324, -0.0643154, -0.684992, -0.0447608)
+bones/115/position = Vector3(-0.0621637, 2.55926, 0.513572)
+bones/115/rotation = Quaternion(0.798349, -0.139325, -0.584523, -0.0395112)
+bones/116/position = Vector3(-0.0953532, 2.56815, 0.478687)
+bones/116/rotation = Quaternion(0.930383, -0.138203, -0.339519, 0.00386543)
+bones/117/position = Vector3(-0.00269708, 2.43028, 0.526312)
+bones/117/rotation = Quaternion(0.987576, -0.0400964, 0.00935013, 0.151652)
+bones/118/rotation = Quaternion(-0.0510243, -8.36275e-09, -1.62563e-07, 0.998697)
+bones/118/scale = Vector3(1.00001, 0.999989, 1.00001)
+bones/119/position = Vector3(-0.00925337, 2.34233, 0.520368)
+bones/119/rotation = Quaternion(0.978976, -0.0343767, 0.0226585, -0.199777)
+bones/119/scale = Vector3(0.999996, 1.00001, 0.999998)
+bones/120/position = Vector3(0.135874, 2.54104, 0.429382)
+bones/120/rotation = Quaternion(0.987774, -0.00042991, 0.0157294, -0.155097)
+bones/121/position = Vector3(-0.116616, 2.56038, 0.421622)
+bones/121/rotation = Quaternion(0.98494, -0.0702479, 0.0264221, -0.15576)
+bones/122/position = Vector3(0.0332116, 2.65944, -0.0705842)
+bones/122/rotation = Quaternion(-0.633333, 0.00842316, -0.0460125, 0.772464)
+bones/123/rotation = Quaternion(-0.322584, -0.00121162, -0.00683712, 0.946515)
+bones/124/rotation = Quaternion(-0.28706, 1.33863e-05, -0.00053349, 0.957912)
+bones/125/rotation = Quaternion(-0.202199, 0.000651262, 0.00264667, 0.979341)
+bones/126/position = Vector3(0.0213086, 2.04387, 0.291416)
+bones/126/rotation = Quaternion(-0.554912, -0.227743, -0.403546, 0.69091)
+bones/127/position = Vector3(0.436636, 2.04233, -0.00603555)
+bones/127/rotation = Quaternion(-0.160674, -0.27628, 0.92092, -0.22307)
+bones/127/scale = Vector3(1.00914, 0.981966, 1.00914)
+bones/128/rotation = Quaternion(2.98339e-09, -0.0893274, 1.67719e-08, 0.996002)
+bones/129/rotation = Quaternion(0.471696, -0.0887018, 0.047945, 0.875977)
+bones/129/scale = Vector3(1.00072, 0.979843, 1.02016)
+bones/130/rotation = Quaternion(-2.04077e-08, 0.200744, -7.04901e-09, 0.979644)
+bones/131/rotation = Quaternion(0.170934, 0.199734, -0.156646, 0.952024)
+bones/131/scale = Vector3(0.99186, 1.01381, 0.99477)
+bones/132/rotation = Quaternion(0.0783025, 0.555143, 0.160821, 0.812294)
+bones/133/rotation = Quaternion(0.346558, -0.351494, 0.0549728, 0.867945)
+bones/133/scale = Vector3(1, 0.999988, 0.999998)
+bones/134/rotation = Quaternion(0.311173, -0.0424918, -0.0571949, 0.947679)
+bones/135/rotation = Quaternion(-0.149154, 0.948608, 0.276142, 0.0405069)
+bones/136/rotation = Quaternion(0.474587, -0.33913, 0.218, 0.782454)
+bones/137/rotation = Quaternion(0.119079, -0.0302991, -0.146089, 0.981611)
+bones/139/rotation = Quaternion(0.189327, 0.510411, 0.0761978, 0.835362)
+bones/140/rotation = Quaternion(0.370829, -0.464359, 0.0911669, 0.79909)
+bones/141/rotation = Quaternion(0.208333, -0.0450114, -0.0494871, 0.975768)
+bones/143/rotation = Quaternion(0.33973, 0.463961, 0.0419968, 0.817043)
+bones/144/rotation = Quaternion(0.346766, -0.464288, 0.0668139, 0.812235)
+bones/145/rotation = Quaternion(0.312628, -0.0513284, -0.0305345, 0.947996)
+bones/147/rotation = Quaternion(0.486157, 0.361674, -0.053741, 0.793697)
+bones/148/rotation = Quaternion(0.33522, -0.530714, 0.0599458, 0.776129)
+bones/149/rotation = Quaternion(0.253389, -0.057419, -0.049569, 0.964386)
+bones/151/position = Vector3(-0.0317867, 2.04275, 0.291213)
+bones/151/rotation = Quaternion(-0.55163, 0.249406, 0.390817, 0.693371)
+bones/152/position = Vector3(-0.451919, 2.05534, 0.000902578)
+bones/152/rotation = Quaternion(0.164793, -0.257712, 0.916438, 0.258011)
+bones/152/scale = Vector3(1.0129, 0.974698, 1.0129)
+bones/153/rotation = Quaternion(-1.17463e-07, 0.0760118, -5.84345e-08, 0.997107)
+bones/154/rotation = Quaternion(0.491757, 0.0753948, -0.0430603, 0.866393)
+bones/154/scale = Vector3(1.0008, 0.970767, 1.02988)
+bones/155/rotation = Quaternion(-6.51005e-10, -0.202436, 6.24587e-08, 0.979295)
+bones/156/rotation = Quaternion(0.169748, -0.201895, 0.0816823, 0.96112)
+bones/156/scale = Vector3(0.98683, 1.02206, 0.991864)
+bones/157/rotation = Quaternion(0.0906175, -0.555281, -0.154177, 0.812208)
+bones/158/rotation = Quaternion(0.360792, 0.347882, -0.0623381, 0.863088)
+bones/159/rotation = Quaternion(0.31465, 0.0405869, 0.053315, 0.94684)
+bones/160/rotation = Quaternion(0.164171, 0.943046, 0.285639, -0.0460756)
+bones/161/rotation = Quaternion(0.486865, 0.338377, -0.223255, 0.773706)
+bones/162/rotation = Quaternion(0.171044, 0.014186, 0.139637, 0.975215)
+bones/164/rotation = Quaternion(0.223379, -0.503869, -0.0757894, 0.830948)
+bones/165/rotation = Quaternion(0.400958, 0.461577, -0.101959, 0.784719)
+bones/166/rotation = Quaternion(0.219395, 0.0450474, 0.0493877, 0.973343)
+bones/168/rotation = Quaternion(0.384634, -0.448938, -0.0428199, 0.805405)
+bones/169/rotation = Quaternion(0.383108, 0.45964, -0.0757627, 0.797633)
+bones/170/rotation = Quaternion(0.319427, 0.0507866, 0.0297069, 0.945783)
+bones/172/rotation = Quaternion(0.533552, -0.334159, 0.0391453, 0.775969)
+bones/173/rotation = Quaternion(0.365816, 0.531263, -0.0725717, 0.760705)
+bones/174/rotation = Quaternion(0.247888, 0.0533933, 0.0444526, 0.966294)
+bones/176/position = Vector3(0.30216, 1.66966, 0.380346)
+bones/176/rotation = Quaternion(0.00680124, 0.59611, 0.802868, 0.00312333)
+bones/177/position = Vector3(-0.297226, 1.65703, 0.378094)
+bones/177/rotation = Quaternion(-0.0219893, 0.596623, 0.802012, -0.0182615)
diff --git a/test.tscn b/test.tscn
new file mode 100644 (file)
index 0000000..c5570b8
--- /dev/null
+++ b/test.tscn
@@ -0,0 +1,80 @@
+[gd_scene load_steps=13 format=3 uid="uid://c1bxy5s8fvheq"]
+
+[ext_resource type="Script" uid="uid://dpsqolvx3mdic" path="res://Scene.gd" id="1_6uqi0"]
+[ext_resource type="PackedScene" uid="uid://ch6s2gvhi64uh" path="res://player.tscn" id="1_37kl0"]
+[ext_resource type="PackedScene" uid="uid://bx83k2u0snfjc" path="res://cube.tscn" id="2_8uh7m"]
+[ext_resource type="Script" uid="uid://dd3sep8kprktl" path="res://ux/debug_overlay.gd" id="2_g14j6"]
+[ext_resource type="Script" uid="uid://mgg7ii0w4vod" path="res://ux/debug_stats.gd" id="2_ppyta"]
+[ext_resource type="Script" uid="uid://bocc5xwqtbkbb" path="res://ux/debug_draw_3d.gd" id="4_vbegm"]
+
+[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_mf4mk"]
+sky_horizon_color = Color(0.662243, 0.671743, 0.686743, 1)
+ground_horizon_color = Color(0.662243, 0.671743, 0.686743, 1)
+
+[sub_resource type="Sky" id="Sky_37kl0"]
+sky_material = SubResource("ProceduralSkyMaterial_mf4mk")
+
+[sub_resource type="Environment" id="Environment_8uh7m"]
+background_mode = 2
+sky = SubResource("Sky_37kl0")
+tonemap_mode = 2
+glow_enabled = true
+
+[sub_resource type="PlaneMesh" id="PlaneMesh_mf4mk"]
+size = Vector2(222, 222)
+
+[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_37kl0"]
+albedo_color = Color(0.133333, 0.278431, 0.133333, 1)
+
+[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_37kl0"]
+data = PackedVector3Array(111, 0, 111, -111, 0, 111, 111, 0, -111, -111, 0, 111, -111, 0, -111, 111, 0, -111)
+
+[node name="Test" type="Node3D"]
+script = ExtResource("1_6uqi0")
+
+[node name="debug" type="CanvasLayer" parent="."]
+unique_name_in_owner = true
+script = ExtResource("2_g14j6")
+
+[node name="DebugStats" type="MarginContainer" parent="debug"]
+offset_right = 40.0
+offset_bottom = 40.0
+theme_override_constants/margin_left = 5
+theme_override_constants/margin_top = 5
+theme_override_constants/margin_right = 5
+theme_override_constants/margin_bottom = 5
+script = ExtResource("2_ppyta")
+
+[node name="VBoxContainer" type="VBoxContainer" parent="debug/DebugStats"]
+layout_mode = 2
+
+[node name="DebugDraw3D" type="Control" parent="debug"]
+layout_mode = 3
+anchors_preset = 0
+offset_right = 40.0
+offset_bottom = 40.0
+script = ExtResource("4_vbegm")
+
+[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
+environment = SubResource("Environment_8uh7m")
+
+[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
+transform = Transform3D(1, 0, 0, 0, 0.499998, 0.866027, 0, -0.866027, 0.499998, 0, 0, 0)
+shadow_enabled = true
+
+[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
+mesh = SubResource("PlaneMesh_mf4mk")
+surface_material_override/0 = SubResource("StandardMaterial3D_37kl0")
+
+[node name="StaticBody3D" type="StaticBody3D" parent="MeshInstance3D"]
+
+[node name="CollisionShape3D" type="CollisionShape3D" parent="MeshInstance3D/StaticBody3D"]
+shape = SubResource("ConcavePolygonShape3D_37kl0")
+
+[node name="player" parent="." instance=ExtResource("1_37kl0")]
+
+[node name="Cube" parent="." instance=ExtResource("2_8uh7m")]
+transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.297243, 0, 10.8886)
+
+[node name="Cube2" parent="." instance=ExtResource("2_8uh7m")]
+transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6.27809, -9.53674e-07, 6.40379)
diff --git a/ux/debug_draw_3d.gd b/ux/debug_draw_3d.gd
new file mode 100644 (file)
index 0000000..65d512f
--- /dev/null
@@ -0,0 +1,49 @@
+extends Control
+
+
+class Vector:
+       var object  # The node to follow
+       var property  # The property to draw
+       var scale  # Scale factor
+       var width  # Line width
+       var color  # Draw color
+
+       func _init(_object, _property, _scale, _width, _color) -> void:
+               object = _object
+               property = _property
+               scale = _scale
+               width = _width
+               color = _color
+
+       func draw(node: Control, camera: Camera3D) -> void:
+               var start = camera.unproject_position(object.global_transform.origin)
+               var endv = object.global_transform.origin + object.get(property) * scale
+               var end = camera.unproject_position(endv)
+               if start != end:
+                       node.draw_line(start, end, color, width)
+                       if camera.is_position_in_frustum(endv):
+                               node.draw_triangle(end, start.direction_to(end), width * 2, color)
+
+
+var vectors = []  # Array to hold all registered values.
+
+func draw_triangle(pos: Vector2, dir: Vector2, length: float, color: Color) -> void:
+       var a = pos + dir.rotated(-PI / 2) * length
+       var b = pos + dir * length
+       var c = pos + dir.rotated(PI / 2) * length
+       var points = PackedVector2Array([a, b, c])
+       draw_polygon(points, PackedColorArray([color]))
+
+
+func _process(_delta: float) -> void:
+       queue_redraw()
+
+
+func _draw() -> void:
+       var camera = get_viewport().get_camera_3d()
+       for vector in vectors:
+               vector.draw(self, camera)
+
+
+func add_vector(object, property, vscale, width, color) -> void:
+       vectors.append(Vector.new(object, property, vscale, width, color))
diff --git a/ux/debug_draw_3d.gd.uid b/ux/debug_draw_3d.gd.uid
new file mode 100644 (file)
index 0000000..0b4dc38
--- /dev/null
@@ -0,0 +1 @@
+uid://bocc5xwqtbkbb
diff --git a/ux/debug_overlay.gd b/ux/debug_overlay.gd
new file mode 100644 (file)
index 0000000..9358517
--- /dev/null
@@ -0,0 +1,18 @@
+extends CanvasLayer
+
+
+@onready var draw = $DebugDraw3D
+@onready var stats = $DebugStats
+
+
+func _ready():
+       if not InputMap.has_action("toggle_debug"):
+               InputMap.add_action("toggle_debug")
+               var ev = InputEventKey.new()
+               ev.physical_keycode = KEY_BACKSLASH
+               InputMap.action_add_event("toggle_debug", ev)
+
+
+func _input(event):
+       if event.is_action_pressed("toggle_debug"):
+               self.visible = not self.visible
diff --git a/ux/debug_overlay.gd.uid b/ux/debug_overlay.gd.uid
new file mode 100644 (file)
index 0000000..cf38035
--- /dev/null
@@ -0,0 +1 @@
+uid://dd3sep8kprktl
diff --git a/ux/debug_stats.gd b/ux/debug_stats.gd
new file mode 100644 (file)
index 0000000..3f930df
--- /dev/null
@@ -0,0 +1,60 @@
+extends MarginContainer
+
+
+class Property:
+       var num_format = "%4.2f"
+       var object  # The object being tracked.
+       var property  # The property to display (NodePath).
+       var label_ref  # A reference to the Label.
+       var display  # Display option (rounded, etc.)
+
+       func _init(_object, _property, _label, _display):
+               object = _object
+               property = _property
+               label_ref = _label
+               display = _display
+
+       func set_label():
+               # Sets the label's text.
+               var s = object.name + "/" + property + " : "
+               var p = object.get_indexed(property)
+               match display:
+                       "":
+                               s += str(p)
+                       "length":
+                               s += num_format % p.length()
+                       "round":
+                               match typeof(p):
+                                       TYPE_INT, TYPE_FLOAT:
+                                               s += num_format % p
+                                       TYPE_VECTOR2, TYPE_VECTOR3:
+                                               s += str(p.round())
+               label_ref.text = s
+
+var props = []  # An array of the tracked properties.
+var _labelSettings: LabelSettings = null
+
+
+func _ready() -> void:
+       _labelSettings = LabelSettings.new()
+       _labelSettings.font_size = 15
+
+
+func _process(_delta):
+       if not visible:
+               return
+       for prop in props:
+               prop.set_label()
+
+
+func add_property(object, property, display):
+       var label = Label.new()
+       label.label_settings = _labelSettings
+       $VBoxContainer.add_child(label)
+       props.append(Property.new(object, property, label, display))
+
+
+func remove_property(object, property):
+       for prop in props:
+               if prop.object == object and prop.property == property:
+                       props.erase(prop)
diff --git a/ux/debug_stats.gd.uid b/ux/debug_stats.gd.uid
new file mode 100644 (file)
index 0000000..766ccd8
--- /dev/null
@@ -0,0 +1 @@
+uid://mgg7ii0w4vod