From: Clifton Palmer Date: Sat, 3 May 2025 16:21:29 +0000 (+0300) Subject: Added debug overlay to test scene X-Git-Url: http://git.purplebirdman.com/frog-ninja.git/commitdiff_plain/HEAD Added debug overlay to test scene --- diff --git a/Scene.gd b/Scene.gd index a9d57e0..749e948 100644 --- a/Scene.gd +++ b/Scene.gd @@ -2,6 +2,21 @@ extends Node3D class_name Scene +@onready var _player: Player = %Player +@onready var _debug: CanvasLayer = %debug +@onready var _version: String = ProjectSettings.get_setting("application/config/version") + + +func _ready() -> void: + _debug.draw.add_vector(_player, "velocity", 1, 1, Color(0,1,0,1)) + _debug.draw.add_vector(_player, "_floor_normal", 1, 1, Color(0, 0, 1, 1)) + _debug.draw.add_vector(_player, "_last_movement_direction", 1, 1, Color(1,0,0,1)) + + _debug.stats.add_property(self, "_version", "") + _debug.stats.add_property(_player, "velocity", "length") + _debug.stats.add_property(_player, "_idle_time", "round") + + func _input(event: InputEvent) -> void: if event.is_action_pressed("left_click"): Input.mouse_mode = Input.MOUSE_MODE_CAPTURED diff --git a/player/player.gd b/player/player.gd index 94283d9..d00302d 100644 --- a/player/player.gd +++ b/player/player.gd @@ -68,6 +68,12 @@ func _unhandled_input(event: InputEvent) -> void: func _input(event: InputEvent): if event.is_action_pressed("player-dash"): _skin.transition_dash() + elif event.is_action_pressed("player-slash"): + _skin.sword_visible() + _skin.transition_slash() + elif event.is_action_pressed("player-shoot"): + _skin.gun_visible() + _skin.transition_gunfire() # Get the XZ input direction based on player's input relative to the camera diff --git a/project.godot b/project.godot index 44782f9..9f61ee2 100644 --- a/project.godot +++ b/project.godot @@ -11,6 +11,7 @@ config_version=5 [application] config/name="Frog Ninja" +config/version="0.1.0" run/main_scene="uid://xtdsp4hhl70p" config/features=PackedStringArray("4.4", "Forward Plus") config/icon="res://icon.svg" diff --git a/skin/prototype_skin.tscn b/skin/prototype_skin.tscn index 5195b89..df92d7d 100644 --- a/skin/prototype_skin.tscn +++ b/skin/prototype_skin.tscn @@ -60,7 +60,6 @@ min_space = 0.0 max_space = 16.0 [sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_s02u1"] -graph_offset = Vector2(-497.194, 34.4427) nodes/Animation/node = SubResource("AnimationNodeAnimation_i12oj") nodes/Animation/position = Vector2(-80, 510) "nodes/Animation 2/node" = SubResource("AnimationNodeAnimation_kang0") @@ -84,80 +83,80 @@ node_connections = [&"TimeScale", 0, &"movement", &"TimeScale 2", 0, &"Animation script = ExtResource("2_bmadk") [node name="Skeleton3D" parent="." index="0"] -bones/0/position = Vector3(0.256878, 0.843901, 0.258026) -bones/0/rotation = Quaternion(0.546758, -0.629317, 0.074969, 0.547171) -bones/1/position = Vector3(-0.297376, 0.833315, -0.177307) -bones/1/rotation = Quaternion(0.409985, 0.450475, 0.412098, 0.677613) -bones/3/position = Vector3(-0.00325433, 0.970366, 0.00598553) -bones/3/rotation = Quaternion(0.0140748, -0.330495, -0.00248497, 0.943699) +bones/0/position = Vector3(0.261016, 0.827375, 0.246751) +bones/0/rotation = Quaternion(0.557085, -0.610793, 0.0732431, 0.557874) +bones/1/position = Vector3(-0.284921, 0.821391, -0.181958) +bones/1/rotation = Quaternion(0.412721, 0.451276, 0.412541, 0.675145) +bones/3/position = Vector3(0.00374505, 0.967373, 8.30963e-05) +bones/3/rotation = Quaternion(0.0199816, -0.329916, -0.00216205, 0.943796) bones/4/rotation = Quaternion(-0.0801557, -2.41264e-07, -4.07088e-07, 0.996782) -bones/5/rotation = Quaternion(0.094469, 0.0411533, -0.00975032, 0.994629) +bones/5/rotation = Quaternion(0.100109, 0.0415746, -0.0105478, 0.994052) bones/5/scale = Vector3(1, 1, 1) -bones/6/rotation = Quaternion(0.107191, 0.122674, -0.0113317, 0.986576) +bones/6/rotation = Quaternion(0.112823, 0.123869, -0.0121451, 0.985789) bones/6/scale = Vector3(1, 0.999996, 1) -bones/7/rotation = Quaternion(0.227792, -0.0101386, 0.00275453, 0.973653) -bones/8/rotation = Quaternion(-0.165356, 0.179751, -0.0306637, 0.96923) -bones/9/rotation = Quaternion(-0.0496211, -0.00400065, -0.0175309, 0.998606) -bones/10/position = Vector3(-0.00325435, 0.970366, 0.00598552) -bones/10/rotation = Quaternion(0.261519, 0.851949, 0.44061, -0.107952) -bones/11/position = Vector3(-0.00325421, 0.970366, 0.00598562) -bones/11/rotation = Quaternion(-0.467279, 0.602136, 0.179732, 0.621916) -bones/12/position = Vector3(0.0706382, 0.901904, 0.0434573) -bones/12/rotation = Quaternion(0.921795, 0.0305123, 0.321639, 0.214268) -bones/12/scale = Vector3(1.01669, 0.96744, 1.01669) -bones/13/rotation = Quaternion(-1.2296e-07, -0.0245743, -4.0984e-08, 0.999698) -bones/14/rotation = Quaternion(0.175129, -0.0254096, 0.00435311, 0.984208) -bones/14/scale = Vector3(0.999989, 0.994189, 1.00639) -bones/15/rotation = Quaternion(-3.75792e-08, 0.0369812, 1.07791e-08, 0.999316) -bones/16/rotation = Quaternion(-0.413224, 0.0363462, 0.109024, 0.903349) -bones/16/scale = Vector3(0.985371, 1.00298, 1.0131) -bones/17/rotation = Quaternion(-0.0241389, 0.934344, -0.355343, -0.0122208) +bones/7/rotation = Quaternion(0.205608, -0.0107313, 0.0034584, 0.978569) +bones/8/rotation = Quaternion(-0.165328, 0.180657, -0.0308184, 0.969061) +bones/9/rotation = Quaternion(-0.0637934, -0.00643369, -0.0272832, 0.997569) +bones/10/position = Vector3(0.00374504, 0.967373, 8.30935e-05) +bones/10/rotation = Quaternion(0.259241, 0.850057, 0.444869, -0.110854) +bones/11/position = Vector3(0.00374517, 0.967373, 8.31895e-05) +bones/11/rotation = Quaternion(-0.465129, 0.600452, 0.184689, 0.6237) +bones/12/position = Vector3(0.0779911, 0.898842, 0.0367176) +bones/12/rotation = Quaternion(0.920408, 0.0267947, 0.320788, 0.22187) +bones/12/scale = Vector3(1.01666, 0.9675, 1.01666) +bones/13/rotation = Quaternion(-7.1744e-08, -0.0243355, -3.53024e-08, 0.999704) +bones/14/rotation = Quaternion(0.180629, -0.0240677, 0.00425817, 0.983248) +bones/14/scale = Vector3(0.999989, 0.994207, 1.00638) +bones/15/rotation = Quaternion(5.58569e-08, 0.0366958, 3.14645e-08, 0.999326) +bones/16/rotation = Quaternion(-0.409985, 0.0354308, 0.108104, 0.90497) +bones/16/scale = Vector3(0.985342, 1.00355, 1.01261) +bones/17/rotation = Quaternion(-0.0234194, 0.934888, -0.35379, -0.0163819) bones/17/scale = Vector3(0.999462, 1.00037, 1.00017) -bones/18/position = Vector3(-0.057651, 0.904201, -0.0589328) -bones/18/rotation = Quaternion(0.938388, -0.102159, 0.328258, -0.0351791) -bones/18/scale = Vector3(1.0153, 0.970086, 1.0153) -bones/19/rotation = Quaternion(-7.33728e-10, 0.0869991, 1.2779e-08, 0.996208) -bones/20/rotation = Quaternion(0.213609, 0.0865187, -0.0183792, 0.972907) -bones/20/scale = Vector3(0.999992, 0.992285, 1.00839) -bones/21/rotation = Quaternion(-3.73188e-08, 0.0721384, -7.65122e-09, 0.997395) -bones/22/rotation = Quaternion(-0.560588, 0.0714899, -0.110115, 0.817622) -bones/22/scale = Vector3(0.988373, 0.989873, 1.0228) -bones/23/rotation = Quaternion(-0.00194637, 0.937021, -0.349248, -0.00362355) +bones/18/position = Vector3(-0.0504379, 0.901674, -0.0654833) +bones/18/rotation = Quaternion(0.938653, -0.104991, 0.327072, -0.0305298) +bones/18/scale = Vector3(1.01788, 0.96518, 1.01788) +bones/19/rotation = Quaternion(-3.00871e-09, 0.0877521, -2.19897e-09, 0.996142) +bones/20/rotation = Quaternion(0.213644, 0.0870434, -0.0183907, 0.972852) +bones/20/scale = Vector3(0.999991, 0.991346, 1.00958) +bones/21/rotation = Quaternion(1.36143e-08, 0.0721779, 4.92577e-08, 0.997392) +bones/22/rotation = Quaternion(-0.556357, 0.0711124, -0.10836, 0.820773) +bones/22/scale = Vector3(0.986173, 0.988683, 1.02662) +bones/23/rotation = Quaternion(-0.00217116, 0.936951, -0.34943, -0.00412756) bones/23/scale = Vector3(0.999647, 1.00025, 1.0001) -bones/24/position = Vector3(0.0522778, 1.57794, 0.162632) -bones/24/rotation = Quaternion(0.168681, -0.0968575, -0.0623047, 0.97892) -bones/25/position = Vector3(0.0554969, 1.61181, 0.175065) -bones/25/rotation = Quaternion(-0.387017, 0.00471295, -0.369487, 0.844793) -bones/26/position = Vector3(0.0739613, 1.62452, 0.155508) -bones/26/rotation = Quaternion(0.758643, -0.0404215, 0.637601, -0.12764) +bones/24/position = Vector3(0.0572297, 1.57458, 0.162382) +bones/24/rotation = Quaternion(0.148444, -0.0977271, -0.0709304, 0.981521) +bones/25/position = Vector3(0.0612029, 1.60879, 0.173441) +bones/25/rotation = Quaternion(-0.404099, 0.00332809, -0.377444, 0.833204) +bones/26/position = Vector3(0.0798252, 1.62038, 0.153347) +bones/26/rotation = Quaternion(0.761871, -0.0361511, 0.637951, -0.10613) bones/26/scale = Vector3(1.00001, 0.999978, 1.00001) bones/27/scale = Vector3(0.999989, 1.00002, 0.999994) -bones/28/position = Vector3(0.0619771, 1.56043, 0.161109) -bones/28/rotation = Quaternion(0.138402, -0.395447, 0.21186, 0.882939) -bones/29/position = Vector3(-0.112546, 1.56432, 0.158827) -bones/29/rotation = Quaternion(0.15862, 0.0876257, 0.146753, 0.972433) -bones/30/position = Vector3(-0.121887, 1.59712, 0.170909) -bones/30/rotation = Quaternion(-0.393805, -0.0562875, 0.428804, 0.811096) -bones/31/position = Vector3(-0.141244, 1.60671, 0.150479) -bones/31/rotation = Quaternion(0.767361, 0.105824, -0.628122, -0.0736326) +bones/28/position = Vector3(0.0665911, 1.55683, 0.161434) +bones/28/rotation = Quaternion(0.11752, -0.390795, 0.210041, 0.888455) +bones/29/position = Vector3(-0.107807, 1.56413, 0.159616) +bones/29/rotation = Quaternion(0.140871, 0.0908719, 0.134573, 0.976621) +bones/30/position = Vector3(-0.116435, 1.59751, 0.170539) +bones/30/rotation = Quaternion(-0.409175, -0.0421183, 0.422202, 0.807804) +bones/31/position = Vector3(-0.13573, 1.60667, 0.149864) +bones/31/rotation = Quaternion(0.768375, 0.0854429, -0.630887, -0.0654263) bones/31/scale = Vector3(1.00001, 0.999994, 1) -bones/33/position = Vector3(-0.119161, 1.54547, 0.156904) -bones/33/rotation = Quaternion(0.110205, 0.384853, -0.135026, 0.906372) -bones/34/position = Vector3(-0.0269115, 1.50433, 0.259308) -bones/34/rotation = Quaternion(-0.599578, -0.0340947, 0.0260301, 0.799166) -bones/35/position = Vector3(-0.0287062, 1.51465, 0.299532) -bones/35/rotation = Quaternion(-0.749103, -0.0386615, 0.0185809, 0.661064) +bones/33/position = Vector3(-0.114809, 1.54536, 0.15844) +bones/33/rotation = Quaternion(0.0962454, 0.382904, -0.152134, 0.906078) +bones/34/position = Vector3(-0.0229353, 1.50629, 0.261984) +bones/34/rotation = Quaternion(-0.615288, -0.0256594, 0.0196542, 0.78764) +bones/35/position = Vector3(-0.0243346, 1.5183, 0.30176) +bones/35/rotation = Quaternion(-0.762145, -0.0291094, 0.0140465, 0.646599) bones/35/scale = Vector3(1.00001, 0.999983, 1.00001) bones/36/rotation = Quaternion(0.172811, -6.05809e-08, 3.59375e-07, 0.984955) bones/36/scale = Vector3(0.99999, 1.00002, 0.999994) -bones/37/position = Vector3(-0.0127844, 1.52266, 0.270168) -bones/37/rotation = Quaternion(-0.12595, 0.584667, 0.775032, 0.204025) -bones/38/position = Vector3(-0.0443478, 1.52004, 0.26943) -bones/38/rotation = Quaternion(0.0592147, 0.597654, 0.758283, -0.253595) -bones/39/position = Vector3(0.0137264, 1.57978, 0.247603) -bones/39/rotation = Quaternion(-0.0340947, 0.599578, 0.799166, -0.0260301) -bones/40/position = Vector3(-0.00865019, 1.56833, 0.263876) -bones/40/rotation = Quaternion(0.717327, 0.587935, 0.287784, -0.238652) +bones/37/position = Vector3(-0.00839127, 1.52473, 0.272081) +bones/37/rotation = Quaternion(-0.122177, 0.60135, 0.761608, 0.208337) +bones/38/position = Vector3(-0.040004, 1.52273, 0.271565) +bones/38/rotation = Quaternion(0.0719509, 0.611116, 0.748972, -0.245767) +bones/39/position = Vector3(0.0191412, 1.58035, 0.247295) +bones/39/rotation = Quaternion(-0.0256588, 0.615288, 0.78764, -0.0196544) +bones/40/position = Vector3(-0.00336599, 1.57003, 0.264033) +bones/40/rotation = Quaternion(0.728514, 0.585436, 0.277233, -0.222878) bones/40/scale = Vector3(0.999995, 1.00001, 0.999995) bones/41/rotation = Quaternion(0.0748491, -0.0181048, -0.043127, 0.996097) bones/41/scale = Vector3(1.00001, 0.999982, 1.00001) @@ -165,8 +164,8 @@ bones/42/rotation = Quaternion(0.274347, -0.0136375, -0.129823, 0.95273) bones/42/scale = Vector3(0.999995, 1.00001, 0.999997) bones/43/rotation = Quaternion(0.278039, -0.00341864, 0.067147, 0.958214) bones/43/scale = Vector3(1, 0.999998, 1) -bones/44/position = Vector3(0.0362773, 1.58194, 0.249059) -bones/44/rotation = Quaternion(-0.639293, 0.602227, 0.302652, -0.370175) +bones/44/position = Vector3(0.0417369, 1.58212, 0.248581) +bones/44/rotation = Quaternion(-0.625044, 0.613818, 0.296058, -0.380653) bones/44/scale = Vector3(1, 0.999997, 1) bones/45/rotation = Quaternion(0.216098, -2.38372e-06, 7.31266e-05, 0.976372) bones/45/scale = Vector3(0.999997, 1, 0.999998) @@ -174,12 +173,12 @@ bones/46/rotation = Quaternion(0.356984, 0.00871236, -0.115499, 0.926902) bones/46/scale = Vector3(0.999999, 1, 0.999997) bones/47/rotation = Quaternion(0.0323356, 0.0279349, -0.125373, 0.991189) bones/47/scale = Vector3(1.00001, 0.999983, 1.00001) -bones/48/position = Vector3(0.0137264, 1.57978, 0.247603) -bones/48/rotation = Quaternion(-0.0340947, 0.599579, 0.799165, -0.0260301) -bones/50/position = Vector3(-0.0788118, 1.57212, 0.245441) -bones/50/rotation = Quaternion(-0.0340947, 0.599578, 0.799166, -0.0260301) -bones/51/position = Vector3(-0.0556367, 1.56444, 0.262778) -bones/51/rotation = Quaternion(0.769885, -0.521045, -0.289714, -0.227718) +bones/48/position = Vector3(0.0191412, 1.58035, 0.247295) +bones/48/rotation = Quaternion(-0.0256594, 0.615288, 0.787639, -0.0196543) +bones/50/position = Vector3(-0.0735213, 1.57454, 0.245737) +bones/50/rotation = Quaternion(-0.0256588, 0.615288, 0.78764, -0.0196544) +bones/51/position = Vector3(-0.0504258, 1.56706, 0.263266) +bones/51/rotation = Quaternion(0.768092, -0.535051, -0.278763, -0.214583) bones/51/scale = Vector3(1, 0.999997, 1) bones/52/rotation = Quaternion(0.0748466, 0.0181067, 0.0431008, 0.996099) bones/52/scale = Vector3(0.999999, 1, 0.999999) @@ -187,8 +186,8 @@ bones/53/rotation = Quaternion(0.274349, 0.0136351, 0.129833, 0.952728) bones/53/scale = Vector3(0.999999, 1, 0.999999) bones/54/rotation = Quaternion(0.27804, 0.00341749, -0.0671438, 0.958214) bones/54/scale = Vector3(0.999997, 1.00001, 0.999996) -bones/55/position = Vector3(-0.101454, 1.57054, 0.245841) -bones/55/rotation = Quaternion(0.580224, 0.644124, 0.346957, 0.357862) +bones/55/position = Vector3(-0.0961886, 1.57344, 0.246285) +bones/55/rotation = Quaternion(0.580542, 0.645447, 0.32939, 0.37131) bones/55/scale = Vector3(1.00001, 0.999987, 1.00001) bones/56/rotation = Quaternion(0.216093, 4.47298e-06, -8.28337e-05, 0.976373) bones/56/scale = Vector3(0.999988, 1.00002, 0.999992) @@ -196,168 +195,169 @@ bones/57/rotation = Quaternion(0.356984, -0.0087149, 0.115506, 0.926901) bones/57/scale = Vector3(1, 0.999998, 0.999997) bones/58/rotation = Quaternion(0.0323454, -0.0279339, 0.125381, 0.991188) bones/58/scale = Vector3(1, 0.999999, 1) -bones/59/position = Vector3(-0.0788118, 1.57212, 0.245441) -bones/59/rotation = Quaternion(-0.0340947, 0.599578, 0.799166, -0.0260301) -bones/61/position = Vector3(-0.024432, 1.47832, 0.245356) -bones/61/rotation = Quaternion(-0.599579, -0.0340947, 0.0260301, 0.799166) -bones/62/position = Vector3(-0.024858, 1.48664, 0.234095) -bones/62/rotation = Quaternion(-0.509158, -0.0310633, 0.029582, 0.859604) -bones/65/position = Vector3(-0.0310146, 1.57317, 0.190968) -bones/65/rotation = Quaternion(0.98765, 0.0390532, 0.0177444, 0.150693) -bones/66/position = Vector3(-0.0205739, 1.43479, 0.234457) -bones/66/rotation = Quaternion(0.318789, 0.00213084, 0.0428424, 0.946855) +bones/59/position = Vector3(-0.0735213, 1.57454, 0.245737) +bones/59/rotation = Quaternion(-0.0256592, 0.615288, 0.78764, -0.0196542) +bones/61/position = Vector3(-0.0210643, 1.47981, 0.249026) +bones/61/rotation = Quaternion(-0.615288, -0.0256588, 0.0196544, 0.78764) +bones/62/position = Vector3(-0.0213702, 1.4877, 0.237451) +bones/62/rotation = Quaternion(-0.526026, -0.0233708, 0.0223269, 0.849854) +bones/65/position = Vector3(-0.0259957, 1.5725, 0.191151) +bones/65/rotation = Quaternion(0.984917, 0.0294477, 0.013324, 0.169985) +bones/66/position = Vector3(-0.018158, 1.43583, 0.239816) +bones/66/rotation = Quaternion(0.30039, 0.00165655, 0.0322792, 0.953269) bones/66/scale = Vector3(0.999995, 1.00001, 0.999996) bones/67/scale = Vector3(1.00001, 0.999993, 1) -bones/68/position = Vector3(-0.0210126, 1.45331, 0.186081) -bones/68/rotation = Quaternion(0.822984, 0.027401, 0.0330037, 0.566442) -bones/69/position = Vector3(0.0520187, 1.58005, 0.192908) -bones/69/rotation = Quaternion(0.993665, -0.0483649, -0.0138258, -0.100494) -bones/72/position = Vector3(-0.114063, 1.5663, 0.189022) -bones/72/rotation = Quaternion(0.985697, 0.132494, 0.0286181, -0.100139) -bones/75/position = Vector3(-0.0263315, 1.49438, 0.269722) -bones/75/rotation = Quaternion(-0.441663, -0.389516, -0.462314, 0.66293) +bones/68/position = Vector3(-0.0183996, 1.45243, 0.190715) +bones/68/rotation = Quaternion(0.81211, 0.0206859, 0.0248356, 0.582609) +bones/69/position = Vector3(0.0571544, 1.57779, 0.192533) +bones/69/rotation = Quaternion(0.994846, -0.0591578, -0.0139404, -0.0811673) +bones/72/position = Vector3(-0.109128, 1.56729, 0.189724) +bones/72/rotation = Quaternion(0.988841, 0.122566, 0.0249854, -0.0809091) +bones/75/position = Vector3(-0.0225179, 1.49685, 0.272755) +bones/75/rotation = Quaternion(-0.45948, -0.392432, -0.460564, 0.650197) bones/76/rotation = Quaternion(-0.15209, -0.0958223, 0.266082, 0.947041) bones/76/scale = Vector3(0.999994, 1.00001, 0.999993) -bones/77/position = Vector3(-0.0263315, 1.49438, 0.269722) -bones/77/rotation = Quaternion(-0.48293, 0.336218, 0.505015, 0.631423) +bones/77/position = Vector3(-0.0225179, 1.49685, 0.272755) +bones/77/rotation = Quaternion(-0.49053, 0.352329, 0.492799, 0.626414) bones/78/rotation = Quaternion(-0.152094, 0.095823, -0.266084, 0.94704) bones/78/scale = Vector3(0.999994, 1.00001, 0.999994) -bones/79/position = Vector3(-0.0250846, 1.48152, 0.261943) -bones/79/rotation = Quaternion(-0.382914, -0.373475, -0.383459, 0.752896) +bones/79/position = Vector3(-0.0215736, 1.48367, 0.265478) +bones/79/rotation = Quaternion(-0.402157, -0.375282, -0.383097, 0.742072) bones/79/scale = Vector3(1, 0.999999, 1) bones/80/rotation = Quaternion(-0.00824502, 0.0772326, 0.0389061, 0.99622) bones/80/scale = Vector3(1, 0.999999, 1) -bones/81/position = Vector3(-0.0250846, 1.48152, 0.261943) -bones/81/rotation = Quaternion(-0.421241, 0.322986, 0.43524, 0.727188) +bones/81/position = Vector3(-0.0215736, 1.48367, 0.265478) +bones/81/rotation = Quaternion(-0.431012, 0.337298, 0.42218, 0.72265) bones/81/scale = Vector3(0.999996, 1.00001, 0.999996) bones/82/rotation = Quaternion(-0.00825141, -0.0772324, -0.0389073, 0.99622) bones/82/scale = Vector3(1.00001, 0.999987, 1.00001) -bones/83/position = Vector3(0.0377778, 1.58792, 0.25258) -bones/83/rotation = Quaternion(0.152774, 0.47694, 0.649033, 0.572665) +bones/83/position = Vector3(0.0433721, 1.58819, 0.251868) +bones/83/rotation = Quaternion(0.147918, 0.489073, 0.633331, 0.581223) bones/83/scale = Vector3(0.999994, 1.00001, 0.999994) bones/84/rotation = Quaternion(-0.223178, 5.86239e-06, 0.0152086, 0.974659) bones/84/scale = Vector3(1.00001, 0.999993, 1) bones/85/rotation = Quaternion(-0.299458, -3.83782e-06, -0.0939993, 0.949468) bones/86/scale = Vector3(0.999999, 1, 0.999999) -bones/87/position = Vector3(-0.0127831, 1.57363, 0.263456) -bones/87/rotation = Quaternion(-0.386223, 0.0709579, 0.918072, 0.0542209) +bones/87/position = Vector3(-0.00739297, 1.5754, 0.263426) +bones/87/rotation = Quaternion(-0.384503, 0.0929387, 0.91672, 0.0560775) bones/87/scale = Vector3(1, 0.999989, 1) bones/88/scale = Vector3(0.999997, 1.00001, 0.999997) -bones/89/position = Vector3(-0.104078, 1.57617, 0.249265) -bones/89/rotation = Quaternion(0.206666, -0.475906, -0.595862, 0.612985) +bones/89/position = Vector3(-0.0986828, 1.57925, 0.249501) +bones/89/rotation = Quaternion(0.188474, -0.48824, -0.593254, 0.611678) bones/89/scale = Vector3(0.999998, 1, 0.999998) bones/90/rotation = Quaternion(-0.223161, 1.53166e-06, -0.0151752, 0.974664) bones/90/scale = Vector3(1, 0.999999, 1) bones/91/rotation = Quaternion(-0.29947, -3.38501e-06, 0.0939802, 0.949466) bones/92/rotation = Quaternion(-0.172941, 1.6437e-06, -0.173091, 0.969603) bones/92/scale = Vector3(1, 0.999994, 1) -bones/93/position = Vector3(-0.0524167, 1.57035, 0.26253) -bones/93/rotation = Quaternion(0.357576, 0.103816, 0.919213, -0.1281) +bones/93/position = Vector3(-0.0470884, 1.57289, 0.262779) +bones/93/rotation = Quaternion(0.363006, 0.117701, 0.917539, -0.11178) bones/93/scale = Vector3(0.999998, 1, 0.999998) bones/94/scale = Vector3(1, 0.999989, 1.00001) -bones/95/position = Vector3(0.0440267, 1.5829, 0.223274) -bones/95/rotation = Quaternion(0.486118, -0.282634, -0.102292, 0.820575) -bones/96/position = Vector3(0.0401625, 1.60121, 0.2542) -bones/96/rotation = Quaternion(0.673804, -0.396465, 0.180431, 0.596865) -bones/98/position = Vector3(-0.0148079, 1.58654, 0.281184) -bones/98/rotation = Quaternion(0.758909, -0.408087, 0.493587, 0.117877) -bones/99/position = Vector3(-0.108052, 1.57031, 0.21972) -bones/99/rotation = Quaternion(0.458634, 0.30259, 0.180922, 0.815697) -bones/100/position = Vector3(-0.108688, 1.58888, 0.250722) -bones/100/rotation = Quaternion(0.642823, 0.436692, -0.114846, 0.61878) -bones/102/position = Vector3(-0.0533655, 1.58335, 0.280283) -bones/102/rotation = Quaternion(0.733944, 0.466443, -0.464379, 0.167659) -bones/103/position = Vector3(0.00572706, 1.49675, 0.25014) -bones/103/rotation = Quaternion(-0.360938, -0.28408, -0.316891, 0.829821) -bones/105/position = Vector3(-0.0573998, 1.49152, 0.248665) -bones/105/rotation = Quaternion(-0.390419, 0.233943, 0.375773, 0.807241) -bones/107/position = Vector3(0.0440267, 1.5829, 0.223274) -bones/107/rotation = Quaternion(0.816763, -0.318711, -0.45418, 0.158249) -bones/109/position = Vector3(-0.108052, 1.57031, 0.21972) -bones/109/rotation = Quaternion(0.776893, 0.381229, 0.484577, 0.127621) -bones/111/position = Vector3(-0.0233564, 1.63996, 0.276035) -bones/111/rotation = Quaternion(0.704616, 0.0895055, 0.703573, -0.0221428) -bones/112/position = Vector3(0.00411968, 1.65055, 0.264943) -bones/112/rotation = Quaternion(0.781134, 0.161355, 0.603034, -0.0120263) -bones/113/position = Vector3(0.0259259, 1.65486, 0.244248) -bones/113/rotation = Quaternion(0.918916, 0.151641, 0.362334, 0.0362254) -bones/114/position = Vector3(-0.0534851, 1.63747, 0.275331) -bones/114/rotation = Quaternion(0.725785, -0.0305373, -0.686407, 0.0338925) -bones/115/position = Vector3(-0.081783, 1.64344, 0.262936) -bones/115/rotation = Quaternion(0.805608, -0.0960455, -0.583622, 0.0340056) -bones/116/position = Vector3(-0.103018, 1.64419, 0.241235) -bones/116/rotation = Quaternion(0.936479, -0.0761256, -0.336619, 0.0624508) -bones/117/position = Vector3(-0.0328069, 1.5709, 0.275706) -bones/117/rotation = Quaternion(0.98201, 0.0384326, 0.0190505, 0.183892) +bones/95/position = Vector3(0.0493704, 1.58194, 0.22278) +bones/95/rotation = Quaternion(0.466871, -0.287869, -0.106319, 0.829372) +bones/96/position = Vector3(0.0460277, 1.60148, 0.252976) +bones/96/rotation = Quaternion(0.658285, -0.398591, 0.180479, 0.612547) +bones/98/position = Vector3(-0.00907496, 1.58901, 0.280656) +bones/98/rotation = Quaternion(0.753233, -0.406013, 0.498578, 0.138614) +bones/99/position = Vector3(-0.10291, 1.57235, 0.220218) +bones/99/rotation = Quaternion(0.446168, 0.303, 0.165543, 0.825664) +bones/100/position = Vector3(-0.103028, 1.5921, 0.250489) +bones/100/rotation = Quaternion(0.634912, 0.428981, -0.131108, 0.629025) +bones/102/position = Vector3(-0.0476927, 1.58657, 0.280026) +bones/102/rotation = Quaternion(0.734362, 0.450019, -0.47664, 0.176095) +bones/103/position = Vector3(0.00950094, 1.4977, 0.252986) +bones/103/rotation = Quaternion(-0.380627, -0.284672, -0.31914, 0.819899) +bones/105/position = Vector3(-0.053736, 1.49382, 0.251944) +bones/105/rotation = Quaternion(-0.402812, 0.246965, 0.363566, 0.802851) +bones/107/position = Vector3(0.0493704, 1.58194, 0.22278) +bones/107/rotation = Quaternion(0.809209, -0.335624, -0.451237, 0.170066) +bones/109/position = Vector3(-0.10291, 1.57235, 0.220218) +bones/109/rotation = Quaternion(0.779205, 0.382766, 0.474066, 0.14694) +bones/111/position = Vector3(-0.016568, 1.64236, 0.273503) +bones/111/rotation = Quaternion(0.707293, 0.0958133, 0.700396, -0.00130073) +bones/112/position = Vector3(0.0110643, 1.65196, 0.26191) +bones/112/rotation = Quaternion(0.784129, 0.164913, 0.598216, 0.0091062) +bones/113/position = Vector3(0.0328132, 1.655, 0.241062) +bones/113/rotation = Quaternion(0.920328, 0.149187, 0.356971, 0.0575482) +bones/114/position = Vector3(-0.0467437, 1.64045, 0.273011) +bones/114/rotation = Quaternion(0.723177, -0.0513604, -0.687532, 0.040947) +bones/115/position = Vector3(-0.0749725, 1.64652, 0.260506) +bones/115/rotation = Quaternion(0.802515, -0.115682, -0.583667, 0.0438213) +bones/116/position = Vector3(-0.0962881, 1.64687, 0.238875) +bones/116/rotation = Quaternion(0.933529, -0.0922564, -0.337686, 0.0773299) +bones/117/position = Vector3(-0.0274107, 1.57355, 0.275849) +bones/117/rotation = Quaternion(0.978628, 0.0289816, 0.0143087, 0.203082) bones/118/scale = Vector3(0.999997, 1.00001, 0.999997) -bones/119/position = Vector3(-0.0282833, 1.51626, 0.275722) -bones/119/rotation = Quaternion(0.984921, 0.0426519, 0.00456037, -0.167603) +bones/119/position = Vector3(-0.02399, 1.51887, 0.277935) +bones/119/rotation = Quaternion(0.988395, 0.0321439, 0.00338562, -0.14843) bones/119/scale = Vector3(1, 0.999997, 1) -bones/120/position = Vector3(0.0412091, 1.64794, 0.210066) -bones/120/rotation = Quaternion(0.989486, 0.0770902, -1.68663e-05, -0.122368) -bones/121/position = Vector3(-0.115353, 1.63498, 0.206408) -bones/121/rotation = Quaternion(0.992204, 0.00766468, 0.0129585, -0.123713) -bones/122/position = Vector3(0.0427734, 1.37321, 0.0432801) -bones/122/rotation = Quaternion(-0.36216, -0.393026, -0.625511, 0.568425) -bones/123/position = Vector3(0.150674, 1.3684, 0.0519462) -bones/123/rotation = Quaternion(0.917877, 0.15788, 0.36404, 0.00708953) -bones/123/scale = Vector3(1.03797, 0.928178, 1.03797) -bones/124/rotation = Quaternion(2.39953e-08, -0.101141, -4.83e-08, 0.994872) -bones/125/rotation = Quaternion(-0.206807, -0.100215, -0.0194682, 0.973041) -bones/125/scale = Vector3(0.999856, 0.983689, 1.02023) -bones/126/rotation = Quaternion(3.20842e-08, 0.0979968, 9.11706e-09, 0.995187) -bones/127/rotation = Quaternion(-0.10666, 0.0973194, -0.158658, 0.976719) -bones/127/scale = Vector3(0.97634, 1.06203, 0.967389) -bones/128/rotation = Quaternion(-0.0708407, 0.705237, -0.0160981, 0.70524) -bones/129/rotation = Quaternion(-0.154627, -0.00639994, 0.00459388, 0.987942) +bones/120/position = Vector3(0.0477975, 1.64649, 0.207108) +bones/120/rotation = Quaternion(0.992426, 0.0665323, -0.00234075, -0.103238) +bones/121/position = Vector3(-0.109005, 1.63653, 0.204546) +bones/121/rotation = Quaternion(0.994475, -0.00265459, 0.0119908, -0.104249) +bones/122/position = Vector3(0.0465869, 1.36949, 0.0448182) +bones/122/rotation = Quaternion(-0.355303, -0.371863, -0.647506, 0.562329) +bones/123/position = Vector3(0.154133, 1.35956, 0.0536439) +bones/123/rotation = Quaternion(0.911506, 0.150641, 0.382598, 0.00915334) +bones/123/scale = Vector3(1.03839, 0.927423, 1.03839) +bones/124/rotation = Quaternion(1.35626e-08, -0.107806, -3.04589e-08, 0.994172) +bones/125/rotation = Quaternion(-0.17432, -0.107371, -0.0173117, 0.978665) +bones/125/scale = Vector3(0.999863, 0.988034, 1.01499) +bones/126/rotation = Quaternion(-1.07487e-08, 0.0934087, -4.46292e-09, 0.995628) +bones/127/rotation = Quaternion(-0.114956, 0.0921874, -0.191477, 0.970373) +bones/127/scale = Vector3(0.981402, 1.05732, 0.967505) +bones/128/rotation = Quaternion(-0.0665079, 0.705397, -0.0201158, 0.705399) +bones/129/rotation = Quaternion(-0.14315, -0.00654626, 0.00600039, 0.989661) bones/130/rotation = Quaternion(-4.31224e-06, 8.13943e-08, 6.78632e-05, 1) -bones/131/rotation = Quaternion(-0.173907, 0.094276, 0.294511, 0.93495) -bones/132/rotation = Quaternion(0.00898102, 0.0261915, -0.00892476, 0.999577) +bones/131/rotation = Quaternion(-0.191667, 0.0886974, 0.289863, 0.933475) +bones/132/rotation = Quaternion(0.00898581, 0.0207359, -0.00750281, 0.999716) bones/133/rotation = Quaternion(0.00626499, 6.74476e-08, -1.43925e-05, 0.99998) -bones/135/rotation = Quaternion(-0.0431512, 0.69872, 0.147342, 0.698726) -bones/136/rotation = Quaternion(-0.200112, 0.00215664, -0.0146126, 0.979662) +bones/135/rotation = Quaternion(-0.0268948, 0.698939, 0.149125, 0.698944) +bones/136/rotation = Quaternion(-0.190037, 0.00469731, -0.0130507, 0.981679) bones/137/rotation = Quaternion(4.65474e-06, -7.81623e-08, -2.01332e-05, 1) -bones/139/rotation = Quaternion(-0.115894, 0.67471, 0.275872, 0.674707) -bones/140/rotation = Quaternion(-0.284925, -0.0162799, -0.0300929, 0.957939) +bones/139/rotation = Quaternion(-0.0991767, 0.675472, 0.278641, 0.67547) +bones/140/rotation = Quaternion(-0.275418, -0.0118091, -0.0280239, 0.960843) bones/141/rotation = Quaternion(4.3083e-06, -3.352e-08, -1.93224e-06, 1) -bones/143/rotation = Quaternion(-0.112884, 0.666554, 0.315969, 0.665678) -bones/144/rotation = Quaternion(-0.345108, -0.00763498, -0.0566091, 0.936823) +bones/143/rotation = Quaternion(-0.0963251, 0.667127, 0.31896, 0.666279) +bones/144/rotation = Quaternion(-0.335606, -0.00297569, -0.0544676, 0.940422) bones/145/rotation = Quaternion(-7.65809e-06, 2.29663e-08, 6.55561e-05, 1) -bones/147/position = Vector3(-0.0432091, 1.37486, 0.0122993) -bones/147/rotation = Quaternion(-0.532369, 0.207071, 0.515342, 0.638849) -bones/148/position = Vector3(-0.13849, 1.36429, -0.0382738) -bones/148/rotation = Quaternion(0.95761, -0.130134, 0.0830815, -0.243197) -bones/148/scale = Vector3(1.02805, 0.946171, 1.02805) -bones/149/rotation = Quaternion(1.69235e-07, 0.0784896, 1.1061e-07, 0.996915) +bones/147/position = Vector3(-0.0395471, 1.37091, 0.0142499) +bones/147/rotation = Quaternion(-0.531413, 0.1891, 0.542982, 0.622103) +bones/148/position = Vector3(-0.134563, 1.35411, -0.0352045) +bones/148/rotation = Quaternion(0.958481, -0.120203, 0.0603389, -0.251444) +bones/148/scale = Vector3(1.02777, 0.94669, 1.02777) +bones/149/rotation = Quaternion(-3.70866e-08, 0.0828916, -2.7993e-08, 0.996559) bones/149/scale = Vector3(1, 1, 1) -bones/150/rotation = Quaternion(-0.206246, 0.0779674, 0.015437, 0.975267) -bones/150/scale = Vector3(0.999856, 0.987811, 1.01438) -bones/151/rotation = Quaternion(3.52022e-08, -0.022448, -2.24783e-07, 0.999748) -bones/152/rotation = Quaternion(-0.169745, -0.0223822, -0.127626, 0.976933) -bones/152/scale = Vector3(0.977931, 1.04278, 0.982625) -bones/153/rotation = Quaternion(-0.0264198, -0.706361, -0.0375105, 0.706364) -bones/154/rotation = Quaternion(-0.165204, 0.0105938, -0.00624617, 0.986183) +bones/150/rotation = Quaternion(-0.200024, 0.0820388, 0.0157404, 0.976224) +bones/150/scale = Vector3(0.999857, 0.988812, 1.01321) +bones/151/rotation = Quaternion(1.45307e-08, -0.0186172, -2.59285e-08, 0.999827) +bones/152/rotation = Quaternion(-0.181057, -0.018223, -0.117066, 0.97631) +bones/152/scale = Vector3(0.977313, 1.04181, 0.984162) +bones/153/rotation = Quaternion(-0.0205253, -0.706539, -0.0343617, 0.706541) +bones/154/rotation = Quaternion(-0.147289, 0.00998131, -0.00826793, 0.989009) bones/155/rotation = Quaternion(8.39836e-07, -2.08393e-07, -6.54599e-05, 1) -bones/156/rotation = Quaternion(-0.241798, -0.0492635, -0.185496, 0.951156) -bones/157/rotation = Quaternion(0.197713, 0.0812624, -0.0213483, 0.976653) +bones/156/rotation = Quaternion(-0.247748, -0.0479796, -0.18632, 0.949528) +bones/157/rotation = Quaternion(0.191007, 0.0799159, -0.0194767, 0.978136) bones/158/rotation = Quaternion(0.00626376, -7.70711e-08, 1.34285e-05, 0.99998) -bones/160/rotation = Quaternion(-0.0615454, -0.702516, -0.0956414, 0.702521) -bones/161/rotation = Quaternion(-0.276936, 0.00972201, 0.0203465, 0.960624) +bones/160/rotation = Quaternion(-0.0619531, -0.702517, -0.0953682, 0.702522) +bones/161/rotation = Quaternion(-0.263103, 0.00975053, 0.0190099, 0.964531) bones/162/rotation = Quaternion(6.46779e-06, 1.28029e-07, 1.90929e-05, 1) -bones/164/rotation = Quaternion(-0.0879215, -0.692117, -0.184984, 0.692116) -bones/165/rotation = Quaternion(-0.327174, -0.0100698, 0.0317775, 0.944376) +bones/164/rotation = Quaternion(-0.0828664, -0.693015, -0.180546, 0.693013) +bones/165/rotation = Quaternion(-0.320504, -0.0106038, 0.03108, 0.946678) bones/166/rotation = Quaternion(4.68059e-06, -2.29112e-07, 1.73853e-06, 1) -bones/168/rotation = Quaternion(-0.0816415, -0.688954, -0.211769, 0.688354) -bones/169/rotation = Quaternion(-0.356385, -0.0197772, 0.0652451, 0.931848) +bones/168/rotation = Quaternion(-0.0806862, -0.689126, -0.210999, 0.68853) +bones/169/rotation = Quaternion(-0.349905, -0.0195459, 0.0649034, 0.93433) bones/170/rotation = Quaternion(-9.53796e-06, -2.47026e-08, -6.50589e-05, 1) -bones/172/position = Vector3(0.0698903, 1.25705, 0.0832586) -bones/172/rotation = Quaternion(-0.138466, 0.542608, 0.822148, 0.102359) -bones/173/position = Vector3(-0.0935538, 1.26019, 0.0243951) -bones/173/rotation = Quaternion(-0.138466, 0.542608, 0.822148, 0.102359) +bones/172/position = Vector3(0.075512, 1.25242, 0.0809254) +bones/172/rotation = Quaternion(-0.138955, 0.528489, 0.831781, 0.0976304) +bones/173/position = Vector3(-0.0882058, 1.25509, 0.0227719) +bones/173/rotation = Quaternion(-0.138955, 0.528489, 0.831781, 0.0976304) [node name="weapon_L" type="BoneAttachment3D" parent="." index="2"] unique_name_in_owner = true -transform = Transform3D(0.19668, -0.770209, -0.606708, -0.606126, 0.390871, -0.692698, 0.770667, 0.503981, -0.389968, 0.256878, 0.843901, 0.258026) +transform = Transform3D(0.243135, -0.762248, -0.599886, -0.598807, 0.368583, -0.71104, 0.763096, 0.532094, -0.366824, 0.261016, 0.827375, 0.246751) +visible = false bone_name = "weapon.L" bone_idx = 0 use_external_skeleton = true @@ -368,7 +368,8 @@ transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, [node name="weapon_R" type="BoneAttachment3D" parent="." index="3"] unique_name_in_owner = true -transform = Transform3D(0.254495, -0.189111, 0.948404, 0.927862, 0.324174, -0.184343, -0.272587, 0.926902, 0.25797, -0.297376, 0.833315, -0.177307) +transform = Transform3D(0.252319, -0.184548, 0.949883, 0.929552, 0.318943, -0.184953, -0.268826, 0.929633, 0.252023, -0.284921, 0.821391, -0.181958) +visible = false bone_name = "weapon.R" bone_idx = 1 use_external_skeleton = true diff --git a/skin/skin.gd b/skin/skin.gd index 913bd58..6d8b923 100644 --- a/skin/skin.gd +++ b/skin/skin.gd @@ -5,6 +5,14 @@ class_name AnimatedSkin @onready var _tree: AnimationTree = %AnimationTree +func sword_visible(b: bool = true): + %weapon_R.visible = b + + +func gun_visible(b: bool = true): + %weapon_L.visible = b + + func set_walking_speed(s: float): _tree.set("parameters/walking/blend_position", s) diff --git a/test.tscn b/test.tscn index 272208c..8b52abd 100644 --- a/test.tscn +++ b/test.tscn @@ -1,8 +1,15 @@ -[gd_scene load_steps=10 format=3 uid="uid://cootj2rfyviyb"] +[gd_scene load_steps=14 format=3 uid="uid://cootj2rfyviyb"] [ext_resource type="Script" uid="uid://ccournv7m7l4y" path="res://Scene.gd" id="1_8uh7m"] [ext_resource type="PackedScene" uid="uid://cchu1yltrhuk3" path="res://player/player.tscn" id="1_37kl0"] [ext_resource type="Texture2D" uid="uid://c8cfruu4iw5at" path="res://texture/grid.png" id="2_6uqi0"] +[ext_resource type="Script" uid="uid://dd3sep8kprktl" path="res://ux/debug_overlay.gd" id="2_ykrsh"] +[ext_resource type="Script" uid="uid://mgg7ii0w4vod" path="res://ux/debug_stats.gd" id="3_g14j6"] +[ext_resource type="Script" uid="uid://bocc5xwqtbkbb" path="res://ux/debug_draw_3d.gd" id="4_g14j6"] + +[sub_resource type="Theme" id="Theme_g14j6"] +default_base_scale = 2.0 +default_font_size = 20 [sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_37kl0"] sky_horizon_color = Color(0.662243, 0.671743, 0.686743, 1) @@ -32,20 +39,45 @@ data = PackedVector3Array(111, 0, 111, -111, 0, 111, 111, 0, -111, -111, 0, 111, [node name="Test" type="Node3D"] script = ExtResource("1_8uh7m") -[node name="WorldEnvironment" type="WorldEnvironment" parent="."] +[node name="debug" type="CanvasLayer" parent="."] +unique_name_in_owner = true +script = ExtResource("2_ykrsh") + +[node name="DebugStats" type="MarginContainer" parent="debug"] +offset_right = 40.0 +offset_bottom = 40.0 +theme = SubResource("Theme_g14j6") +theme_override_constants/margin_left = 20 +theme_override_constants/margin_top = 20 +theme_override_constants/margin_right = 20 +theme_override_constants/margin_bottom = 20 +script = ExtResource("3_g14j6") + +[node name="DebugDraw3D" type="Control" parent="debug"] +layout_mode = 3 +anchors_preset = 0 +offset_right = 40.0 +offset_bottom = 40.0 +script = ExtResource("4_g14j6") + +[node name="Player" parent="." instance=ExtResource("1_37kl0")] +unique_name_in_owner = true + +[node name="map" type="Node3D" parent="."] + +[node name="WorldEnvironment" type="WorldEnvironment" parent="map"] environment = SubResource("Environment_6uqi0") -[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] -transform = Transform3D(-0.866023, -0.433016, 0.250001, 0, 0.499998, 0.866027, -0.500003, 0.749999, -0.43301, 0, 0, 0) +[node name="DirectionalLight3D" type="DirectionalLight3D" parent="map"] +transform = Transform3D(-0.866024, -0.433016, 0.250001, 0, 0.499998, 0.866026, -0.500003, 0.749999, -0.43301, 0, 0, 0) shadow_enabled = true -[node name="MeshInstance3D" type="MeshInstance3D" parent="."] +[node name="MeshInstance3D" type="MeshInstance3D" parent="map"] mesh = SubResource("PlaneMesh_mf4mk") +skeleton = NodePath("../..") surface_material_override/0 = SubResource("StandardMaterial3D_37kl0") -[node name="StaticBody3D" type="StaticBody3D" parent="MeshInstance3D"] +[node name="StaticBody3D" type="StaticBody3D" parent="map/MeshInstance3D"] -[node name="CollisionShape3D" type="CollisionShape3D" parent="MeshInstance3D/StaticBody3D"] +[node name="CollisionShape3D" type="CollisionShape3D" parent="map/MeshInstance3D/StaticBody3D"] shape = SubResource("ConcavePolygonShape3D_37kl0") - -[node name="Player" parent="." instance=ExtResource("1_37kl0")] diff --git a/ux/debug_draw_3d.gd b/ux/debug_draw_3d.gd new file mode 100644 index 0000000..fd922f0 --- /dev/null +++ b/ux/debug_draw_3d.gd @@ -0,0 +1,50 @@ +extends Control +class_name DebugDraw3D + + +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 index 0000000..0b4dc38 --- /dev/null +++ b/ux/debug_draw_3d.gd.uid @@ -0,0 +1 @@ +uid://bocc5xwqtbkbb diff --git a/ux/debug_overlay.gd b/ux/debug_overlay.gd new file mode 100644 index 0000000..f8113d9 --- /dev/null +++ b/ux/debug_overlay.gd @@ -0,0 +1,19 @@ +extends CanvasLayer +class_name DebugOverlay + + +@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 index 0000000..cf38035 --- /dev/null +++ b/ux/debug_overlay.gd.uid @@ -0,0 +1 @@ +uid://dd3sep8kprktl diff --git a/ux/debug_stats.gd b/ux/debug_stats.gd new file mode 100644 index 0000000..db77458 --- /dev/null +++ b/ux/debug_stats.gd @@ -0,0 +1,68 @@ +extends MarginContainer +class_name DebugStats + + +var _vbox: VBoxContainer = null + + +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 * 2 + + # add VBoxContainer as child + _vbox = VBoxContainer.new() + add_child(_vbox) + + +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 + _vbox.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 index 0000000..766ccd8 --- /dev/null +++ b/ux/debug_stats.gd.uid @@ -0,0 +1 @@ +uid://mgg7ii0w4vod