From 9e1c31981eef5dbe759d5071b66acbe5ac9769c4 Mon Sep 17 00:00:00 2001 From: hiina Date: Mon, 10 Feb 2025 19:39:14 -0700 Subject: [PATCH] hack for particle system collision detection --- .gitignore | 1 + assets/maps/holodeck/holodeck_env.tres | 9 +- assets/meshes/control_pad/control_pad.gd | 2 + override.cfg | 3 + scenes/main_menu/main_menu_level.tscn | 48 +- scenes/pickable_demo/pickable_demo.tscn | 48 +- scenes/world_grab_demo/particle_test.gdshader | 40 ++ .../world_grab_demo/particleemission.gdshader | 79 ++++ .../world_grab_demo/particleprocess.gdshader | 442 ++++++++++++++++++ .../proxy_collision_detector.gd | 90 ++++ scenes/world_grab_demo/world_grab_demo.tscn | 174 ++++--- 11 files changed, 819 insertions(+), 117 deletions(-) create mode 100644 override.cfg create mode 100644 scenes/world_grab_demo/particle_test.gdshader create mode 100644 scenes/world_grab_demo/particleemission.gdshader create mode 100644 scenes/world_grab_demo/particleprocess.gdshader create mode 100644 scenes/world_grab_demo/proxy_collision_detector.gd diff --git a/.gitignore b/.gitignore index 4600f82..2a6ea76 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ logs Thumbs.db android/ .venv/ +.vscode diff --git a/assets/maps/holodeck/holodeck_env.tres b/assets/maps/holodeck/holodeck_env.tres index 43c4c34..649a0e2 100644 --- a/assets/maps/holodeck/holodeck_env.tres +++ b/assets/maps/holodeck/holodeck_env.tres @@ -12,11 +12,12 @@ sky_material = SubResource("PanoramaSkyMaterial_5ed67") background_mode = 1 sky = SubResource("1") sky_rotation = Vector3(0, 0.523599, 0) -ambient_light_color = Color(0.247059, 0.247059, 0.247059, 1) +ambient_light_color = Color(0.130772, 0.130772, 0.130772, 1) ambient_light_sky_contribution = 0.0 +ambient_light_energy = 0.75 reflected_light_source = 1 +ssil_enabled = true +sdfgi_enabled = true glow_enabled = true glow_normalized = true -glow_intensity = 1.17 -glow_strength = 1.06 -glow_bloom = 1.0 +glow_blend_mode = 0 diff --git a/assets/meshes/control_pad/control_pad.gd b/assets/meshes/control_pad/control_pad.gd index 4f51a98..8e4a94c 100644 --- a/assets/meshes/control_pad/control_pad.gd +++ b/assets/meshes/control_pad/control_pad.gd @@ -58,6 +58,8 @@ func _on_quit() -> void: func _update_location() -> void: # Pick the location to set as our parent var location : ControlPadLocation + if not _staging: + return if _staging.control_pad_hand == "LEFT": location = ControlPadLocation.find_left(self) else: diff --git a/override.cfg b/override.cfg new file mode 100644 index 0000000..0d1998e --- /dev/null +++ b/override.cfg @@ -0,0 +1,3 @@ +[xr] + +openxr/enabled=false diff --git a/scenes/main_menu/main_menu_level.tscn b/scenes/main_menu/main_menu_level.tscn index a4c92c5..dfccd06 100644 --- a/scenes/main_menu/main_menu_level.tscn +++ b/scenes/main_menu/main_menu_level.tscn @@ -42,65 +42,65 @@ [ext_resource type="Texture2D" uid="uid://cr1l4g7btdyht" path="res://scenes/origin_gravity_demo/origin_gravity_demo.png" id="32_c4n1q"] [ext_resource type="Texture2D" uid="uid://dhd30j0xpcxoi" path="res://scenes/sphere_world_demo/sphere_world_demo.png" id="34_xw8ig"] -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_olygm"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_yg038"] animation = &"Grip" -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_qybql"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_enmd7"] animation = &"Grip" -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_implj"] +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_cqua4"] filter_enabled = true filters = ["Armature/Skeleton3D:Little_Distal_L", "Armature/Skeleton3D:Little_Intermediate_L", "Armature/Skeleton3D:Little_Metacarpal_L", "Armature/Skeleton3D:Little_Proximal_L", "Armature/Skeleton3D:Middle_Distal_L", "Armature/Skeleton3D:Middle_Intermediate_L", "Armature/Skeleton3D:Middle_Metacarpal_L", "Armature/Skeleton3D:Middle_Proximal_L", "Armature/Skeleton3D:Ring_Distal_L", "Armature/Skeleton3D:Ring_Intermediate_L", "Armature/Skeleton3D:Ring_Metacarpal_L", "Armature/Skeleton3D:Ring_Proximal_L", "Armature/Skeleton3D:Thumb_Distal_L", "Armature/Skeleton3D:Thumb_Metacarpal_L", "Armature/Skeleton3D:Thumb_Proximal_L", "Armature/Skeleton:Little_Distal_L", "Armature/Skeleton:Little_Intermediate_L", "Armature/Skeleton:Little_Proximal_L", "Armature/Skeleton:Middle_Distal_L", "Armature/Skeleton:Middle_Intermediate_L", "Armature/Skeleton:Middle_Proximal_L", "Armature/Skeleton:Ring_Distal_L", "Armature/Skeleton:Ring_Intermediate_L", "Armature/Skeleton:Ring_Proximal_L", "Armature/Skeleton:Thumb_Distal_L", "Armature/Skeleton:Thumb_Proximal_L"] -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_pxphv"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_7ki8b"] animation = &"Grip 5" -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_mrgbu"] +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_6wi1u"] filter_enabled = true filters = ["Armature/Skeleton3D:Index_Distal_L", "Armature/Skeleton3D:Index_Intermediate_L", "Armature/Skeleton3D:Index_Metacarpal_L", "Armature/Skeleton3D:Index_Proximal_L", "Armature/Skeleton:Index_Distal_L", "Armature/Skeleton:Index_Intermediate_L", "Armature/Skeleton:Index_Proximal_L"] -[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_0b4wh"] +[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_q7l4u"] graph_offset = Vector2(-536, 11) -nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_olygm") +nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_yg038") nodes/ClosedHand1/position = Vector2(-600, 300) -nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_qybql") +nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_enmd7") nodes/ClosedHand2/position = Vector2(-360, 300) -nodes/Grip/node = SubResource("AnimationNodeBlend2_implj") +nodes/Grip/node = SubResource("AnimationNodeBlend2_cqua4") nodes/Grip/position = Vector2(0, 20) -nodes/OpenHand/node = SubResource("AnimationNodeAnimation_pxphv") +nodes/OpenHand/node = SubResource("AnimationNodeAnimation_7ki8b") nodes/OpenHand/position = Vector2(-600, 100) -nodes/Trigger/node = SubResource("AnimationNodeBlend2_mrgbu") +nodes/Trigger/node = SubResource("AnimationNodeBlend2_6wi1u") nodes/Trigger/position = Vector2(-360, 20) node_connections = [&"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1", &"output", 0, &"Grip"] -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_0cq74"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ou3pb"] animation = &"Grip" -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_4j20x"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_qqj8i"] animation = &"Grip" -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_cvxoi"] +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_osrqt"] filter_enabled = true filters = ["Armature/Skeleton3D:Little_Distal_R", "Armature/Skeleton3D:Little_Intermediate_R", "Armature/Skeleton3D:Little_Metacarpal_R", "Armature/Skeleton3D:Little_Proximal_R", "Armature/Skeleton3D:Middle_Distal_R", "Armature/Skeleton3D:Middle_Intermediate_R", "Armature/Skeleton3D:Middle_Metacarpal_R", "Armature/Skeleton3D:Middle_Proximal_R", "Armature/Skeleton3D:Ring_Distal_R", "Armature/Skeleton3D:Ring_Intermediate_R", "Armature/Skeleton3D:Ring_Metacarpal_R", "Armature/Skeleton3D:Ring_Proximal_R", "Armature/Skeleton3D:Thumb_Distal_R", "Armature/Skeleton3D:Thumb_Metacarpal_R", "Armature/Skeleton3D:Thumb_Proximal_R", "Armature/Skeleton:Little_Distal_R", "Armature/Skeleton:Little_Intermediate_R", "Armature/Skeleton:Little_Proximal_R", "Armature/Skeleton:Middle_Distal_R", "Armature/Skeleton:Middle_Intermediate_R", "Armature/Skeleton:Middle_Proximal_R", "Armature/Skeleton:Ring_Distal_R", "Armature/Skeleton:Ring_Intermediate_R", "Armature/Skeleton:Ring_Proximal_R", "Armature/Skeleton:Thumb_Distal_R", "Armature/Skeleton:Thumb_Proximal_R"] -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_pyyee"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_b4tlu"] animation = &"Grip 5" -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_glq5p"] +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_cgjta"] filter_enabled = true filters = ["Armature/Skeleton3D:Index_Distal_R", "Armature/Skeleton3D:Index_Intermediate_R", "Armature/Skeleton3D:Index_Metacarpal_R", "Armature/Skeleton3D:Index_Proximal_R", "Armature/Skeleton:Index_Distal_R", "Armature/Skeleton:Index_Intermediate_R", "Armature/Skeleton:Index_Proximal_R"] -[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_anrm0"] +[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_5tyiu"] graph_offset = Vector2(-552.664, 107.301) -nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_0cq74") +nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_ou3pb") nodes/ClosedHand1/position = Vector2(-600, 300) -nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_4j20x") +nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_qqj8i") nodes/ClosedHand2/position = Vector2(-360, 300) -nodes/Grip/node = SubResource("AnimationNodeBlend2_cvxoi") +nodes/Grip/node = SubResource("AnimationNodeBlend2_osrqt") nodes/Grip/position = Vector2(0, 40) -nodes/OpenHand/node = SubResource("AnimationNodeAnimation_pyyee") +nodes/OpenHand/node = SubResource("AnimationNodeAnimation_b4tlu") nodes/OpenHand/position = Vector2(-600, 100) -nodes/Trigger/node = SubResource("AnimationNodeBlend2_glq5p") +nodes/Trigger/node = SubResource("AnimationNodeBlend2_cgjta") nodes/Trigger/position = Vector2(-360, 40) node_connections = [&"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1", &"output", 0, &"Grip"] @@ -151,7 +151,7 @@ transform = Transform3D(0.999999, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) [node name="AnimationTree" parent="XROrigin3D/LeftHand/LeftHand" index="1"] root_node = NodePath("../Hand_low_L") -tree_root = SubResource("AnimationNodeBlendTree_0b4wh") +tree_root = SubResource("AnimationNodeBlendTree_q7l4u") [node name="FunctionPoseDetector" parent="XROrigin3D/LeftHand" index="1" instance=ExtResource("5_xgcrx")] @@ -198,7 +198,7 @@ transform = Transform3D(0.999999, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) [node name="AnimationTree" parent="XROrigin3D/RightHand/RightHand" index="1"] root_node = NodePath("../Hand_low_R") -tree_root = SubResource("AnimationNodeBlendTree_anrm0") +tree_root = SubResource("AnimationNodeBlendTree_5tyiu") [node name="FunctionPoseDetector" parent="XROrigin3D/RightHand" index="1" instance=ExtResource("5_xgcrx")] diff --git a/scenes/pickable_demo/pickable_demo.tscn b/scenes/pickable_demo/pickable_demo.tscn index 20e1857..aac256f 100644 --- a/scenes/pickable_demo/pickable_demo.tscn +++ b/scenes/pickable_demo/pickable_demo.tscn @@ -36,65 +36,65 @@ [ext_resource type="PackedScene" uid="uid://bmjemjgtnpkpo" path="res://assets/3dmodelscc0/models/scenes/sniper_rifle.tscn" id="25_xgu4l"] [ext_resource type="PackedScene" uid="uid://deuxld12hxsq0" path="res://scenes/pickable_demo/objects/picatinny_scope.tscn" id="26_x40vw"] -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_rk382"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_hyrry"] animation = &"Grip" -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_kknvj"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_w7n3y"] animation = &"Grip" -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_vadt0"] +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_4ldx4"] filter_enabled = true filters = ["Armature/Skeleton3D:Little_Distal_L", "Armature/Skeleton3D:Little_Intermediate_L", "Armature/Skeleton3D:Little_Metacarpal_L", "Armature/Skeleton3D:Little_Proximal_L", "Armature/Skeleton3D:Middle_Distal_L", "Armature/Skeleton3D:Middle_Intermediate_L", "Armature/Skeleton3D:Middle_Metacarpal_L", "Armature/Skeleton3D:Middle_Proximal_L", "Armature/Skeleton3D:Ring_Distal_L", "Armature/Skeleton3D:Ring_Intermediate_L", "Armature/Skeleton3D:Ring_Metacarpal_L", "Armature/Skeleton3D:Ring_Proximal_L", "Armature/Skeleton3D:Thumb_Distal_L", "Armature/Skeleton3D:Thumb_Metacarpal_L", "Armature/Skeleton3D:Thumb_Proximal_L", "Armature/Skeleton:Little_Distal_L", "Armature/Skeleton:Little_Intermediate_L", "Armature/Skeleton:Little_Proximal_L", "Armature/Skeleton:Middle_Distal_L", "Armature/Skeleton:Middle_Intermediate_L", "Armature/Skeleton:Middle_Proximal_L", "Armature/Skeleton:Ring_Distal_L", "Armature/Skeleton:Ring_Intermediate_L", "Armature/Skeleton:Ring_Proximal_L", "Armature/Skeleton:Thumb_Distal_L", "Armature/Skeleton:Thumb_Proximal_L"] -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_lx1b2"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_umxjy"] animation = &"Grip 5" -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_n43q2"] +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_sx74n"] filter_enabled = true filters = ["Armature/Skeleton3D:Index_Distal_L", "Armature/Skeleton3D:Index_Intermediate_L", "Armature/Skeleton3D:Index_Metacarpal_L", "Armature/Skeleton3D:Index_Proximal_L", "Armature/Skeleton:Index_Distal_L", "Armature/Skeleton:Index_Intermediate_L", "Armature/Skeleton:Index_Proximal_L"] -[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_anlui"] +[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_net35"] graph_offset = Vector2(-536, 11) -nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_rk382") +nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_hyrry") nodes/ClosedHand1/position = Vector2(-600, 300) -nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_kknvj") +nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_w7n3y") nodes/ClosedHand2/position = Vector2(-360, 300) -nodes/Grip/node = SubResource("AnimationNodeBlend2_vadt0") +nodes/Grip/node = SubResource("AnimationNodeBlend2_4ldx4") nodes/Grip/position = Vector2(0, 20) -nodes/OpenHand/node = SubResource("AnimationNodeAnimation_lx1b2") +nodes/OpenHand/node = SubResource("AnimationNodeAnimation_umxjy") nodes/OpenHand/position = Vector2(-600, 100) -nodes/Trigger/node = SubResource("AnimationNodeBlend2_n43q2") +nodes/Trigger/node = SubResource("AnimationNodeBlend2_sx74n") nodes/Trigger/position = Vector2(-360, 20) node_connections = [&"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1", &"output", 0, &"Grip"] -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_lxfji"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_8m0xv"] animation = &"Grip" -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_0js8n"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_kmq2h"] animation = &"Grip" -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_1ptcv"] +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_05bsb"] filter_enabled = true filters = ["Armature/Skeleton3D:Little_Distal_R", "Armature/Skeleton3D:Little_Intermediate_R", "Armature/Skeleton3D:Little_Metacarpal_R", "Armature/Skeleton3D:Little_Proximal_R", "Armature/Skeleton3D:Middle_Distal_R", "Armature/Skeleton3D:Middle_Intermediate_R", "Armature/Skeleton3D:Middle_Metacarpal_R", "Armature/Skeleton3D:Middle_Proximal_R", "Armature/Skeleton3D:Ring_Distal_R", "Armature/Skeleton3D:Ring_Intermediate_R", "Armature/Skeleton3D:Ring_Metacarpal_R", "Armature/Skeleton3D:Ring_Proximal_R", "Armature/Skeleton3D:Thumb_Distal_R", "Armature/Skeleton3D:Thumb_Metacarpal_R", "Armature/Skeleton3D:Thumb_Proximal_R", "Armature/Skeleton:Little_Distal_R", "Armature/Skeleton:Little_Intermediate_R", "Armature/Skeleton:Little_Proximal_R", "Armature/Skeleton:Middle_Distal_R", "Armature/Skeleton:Middle_Intermediate_R", "Armature/Skeleton:Middle_Proximal_R", "Armature/Skeleton:Ring_Distal_R", "Armature/Skeleton:Ring_Intermediate_R", "Armature/Skeleton:Ring_Proximal_R", "Armature/Skeleton:Thumb_Distal_R", "Armature/Skeleton:Thumb_Proximal_R"] -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_hvnnw"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ahncs"] animation = &"Grip 5" -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_2xpas"] +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_xpqel"] filter_enabled = true filters = ["Armature/Skeleton3D:Index_Distal_R", "Armature/Skeleton3D:Index_Intermediate_R", "Armature/Skeleton3D:Index_Metacarpal_R", "Armature/Skeleton3D:Index_Proximal_R", "Armature/Skeleton:Index_Distal_R", "Armature/Skeleton:Index_Intermediate_R", "Armature/Skeleton:Index_Proximal_R"] -[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_lmidc"] +[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_26m0p"] graph_offset = Vector2(-552.664, 107.301) -nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_lxfji") +nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_8m0xv") nodes/ClosedHand1/position = Vector2(-600, 300) -nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_0js8n") +nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_kmq2h") nodes/ClosedHand2/position = Vector2(-360, 300) -nodes/Grip/node = SubResource("AnimationNodeBlend2_1ptcv") +nodes/Grip/node = SubResource("AnimationNodeBlend2_05bsb") nodes/Grip/position = Vector2(0, 40) -nodes/OpenHand/node = SubResource("AnimationNodeAnimation_hvnnw") +nodes/OpenHand/node = SubResource("AnimationNodeAnimation_ahncs") nodes/OpenHand/position = Vector2(-600, 100) -nodes/Trigger/node = SubResource("AnimationNodeBlend2_2xpas") +nodes/Trigger/node = SubResource("AnimationNodeBlend2_xpqel") nodes/Trigger/position = Vector2(-360, 40) node_connections = [&"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1", &"output", 0, &"Grip"] @@ -139,7 +139,7 @@ push_bodies = false [node name="AnimationTree" parent="XROrigin3D/LeftHand/XRToolsCollisionHand/LeftHand" index="1"] root_node = NodePath("../Hand_Nails_low_L") -tree_root = SubResource("AnimationNodeBlendTree_anlui") +tree_root = SubResource("AnimationNodeBlendTree_net35") [node name="MovementDirect" parent="XROrigin3D/LeftHand/XRToolsCollisionHand" index="1" instance=ExtResource("7")] strafe = true @@ -192,7 +192,7 @@ push_bodies = false [node name="AnimationTree" parent="XROrigin3D/RightHand/XRToolsCollisionHand/RightHand" index="1"] root_node = NodePath("../Hand_Nails_R") -tree_root = SubResource("AnimationNodeBlendTree_lmidc") +tree_root = SubResource("AnimationNodeBlendTree_26m0p") [node name="MovementDirect" parent="XROrigin3D/RightHand/XRToolsCollisionHand" index="1" instance=ExtResource("7")] diff --git a/scenes/world_grab_demo/particle_test.gdshader b/scenes/world_grab_demo/particle_test.gdshader new file mode 100644 index 0000000..b778bb9 --- /dev/null +++ b/scenes/world_grab_demo/particle_test.gdshader @@ -0,0 +1,40 @@ +shader_type spatial; +render_mode unshaded, depth_draw_never, cull_disabled; + +// Uniforms that define the bounding box in world space. +uniform vec3 bbox_min; +uniform vec3 bbox_max; + +void vertex() { + // Compute the particle’s center in world space. + // (This assumes that your particle’s mesh is centered at the local origin.) + vec3 particle_center = (MODEL_MATRIX * vec4(0.0, 0.0, 0.0, 1.0)).xyz; + + // Check if the particle’s center is within the provided bounding box. + bool inside = (particle_center.x >= bbox_min.x && particle_center.x <= bbox_max.x && + particle_center.y >= bbox_min.y && particle_center.y <= bbox_max.y && + particle_center.z >= bbox_min.z && particle_center.z <= bbox_max.z); + + if (inside) { + // If the particle qualifies, we override its vertex positions so that + // regardless of its original quad, it covers the full clip space (i.e. the whole screen). + // This assumes exactly 4 vertices per instance. + if (VERTEX_ID == 0) { + POSITION = vec4(-1.0, -1.0, 0.0, 1.0); + } else if (VERTEX_ID == 1) { + POSITION = vec4( 1.0, -1.0, 0.0, 1.0); + } else if (VERTEX_ID == 2) { + POSITION = vec4(-1.0, 1.0, 0.0, 1.0); + } else { + POSITION = vec4( 1.0, 1.0, 0.0, 1.0); + } + } else { + // Otherwise, move the geometry far off clip space so it isn’t rendered. + POSITION = vec4(2.0, 2.0, 2.0, 1.0); + } +} + +void fragment() { + // Output pure red color. + ALBEDO = vec3(1.0, 0.0, 0.0); +} diff --git a/scenes/world_grab_demo/particleemission.gdshader b/scenes/world_grab_demo/particleemission.gdshader new file mode 100644 index 0000000..0ecd34f --- /dev/null +++ b/scenes/world_grab_demo/particleemission.gdshader @@ -0,0 +1,79 @@ +// NOTE: Shader automatically converted from Godot Engine 4.3.stable's StandardMaterial3D. + +shader_type spatial; +render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_burley, specular_schlick_ggx, vertex_lighting; + +uniform vec4 albedo : source_color; +uniform sampler2D texture_albedo : source_color, filter_linear_mipmap, repeat_enable; +uniform float point_size : hint_range(0.1, 128.0, 0.1); + +uniform float roughness : hint_range(0.0, 1.0); +uniform sampler2D texture_metallic : hint_default_white, filter_linear_mipmap, repeat_enable; +uniform vec4 metallic_texture_channel; +uniform sampler2D texture_roughness : hint_roughness_r, filter_linear_mipmap, repeat_enable; + +uniform float specular : hint_range(0.0, 1.0, 0.01); +uniform float metallic : hint_range(0.0, 1.0, 0.01); + +uniform sampler2D texture_emission : source_color, hint_default_black, filter_linear_mipmap, repeat_enable; +uniform vec4 emission : source_color; +uniform float emission_energy : hint_range(0.0, 100.0, 0.01); + +uniform vec3 uv1_scale; +uniform vec3 uv1_offset; +uniform vec3 uv2_scale; +uniform vec3 uv2_offset; + +void vertex() { + // Vertex Color is sRGB: Enabled + if (!OUTPUT_IS_SRGB) { + COLOR.rgb = mix( + pow((COLOR.rgb + vec3(0.055)) * (1.0 / (1.0 + 0.055)), vec3(2.4)), + COLOR.rgb * (1.0 / 12.92), + lessThan(COLOR.rgb, vec3(0.04045))); + } + + // Shading Mode: Per Vertex + ROUGHNESS = roughness; + + UV = UV * uv1_scale.xy + uv1_offset.xy; + + // Billboard Mode: Enabled + MODELVIEW_MATRIX = VIEW_MATRIX * mat4( + MAIN_CAM_INV_VIEW_MATRIX[0], + MAIN_CAM_INV_VIEW_MATRIX[1], + MAIN_CAM_INV_VIEW_MATRIX[2], + MODEL_MATRIX[3]); + + // Billboard Keep Scale: Enabled + MODELVIEW_MATRIX = MODELVIEW_MATRIX * mat4( + vec4(length(MODEL_MATRIX[0].xyz), 0.0, 0.0, 0.0), + vec4(0.0, length(MODEL_MATRIX[1].xyz), 0.0, 0.0), + vec4(0.0, 0.0, length(MODEL_MATRIX[2].xyz), 0.0), + vec4(0.0, 0.0, 0.0, 1.0)); + MODELVIEW_NORMAL_MATRIX = mat3(MODELVIEW_MATRIX); +} + +void fragment() { + vec2 base_uv = UV; + + vec4 albedo_tex = texture(texture_albedo, base_uv); + + // Vertex Color Use as Albedo: Enabled + albedo_tex *= COLOR; + + ALBEDO = albedo.rgb * albedo_tex.rgb; + + float metallic_tex = dot(texture(texture_metallic, base_uv), metallic_texture_channel); + METALLIC = metallic_tex * metallic; + SPECULAR = specular; + + vec4 roughness_texture_channel = vec4(1.0, 0.0, 0.0, 0.0); + float roughness_tex = dot(texture(texture_roughness, base_uv), roughness_texture_channel); + ROUGHNESS = roughness_tex * roughness; + + // Emission: Enabled + vec3 emission_tex = texture(texture_emission, base_uv).rgb; + // Emission Operator: Add + EMISSION = (ALBEDO) * emission_energy; +} diff --git a/scenes/world_grab_demo/particleprocess.gdshader b/scenes/world_grab_demo/particleprocess.gdshader new file mode 100644 index 0000000..6c94dc3 --- /dev/null +++ b/scenes/world_grab_demo/particleprocess.gdshader @@ -0,0 +1,442 @@ +// NOTE: Shader automatically converted from Godot Engine 4.3.stable's ParticleProcessMaterial. + +shader_type particles; +render_mode disable_velocity; + +uniform vec3 direction; +uniform float spread; +uniform float flatness; +uniform float inherit_emitter_velocity_ratio = 0.0; +uniform float initial_linear_velocity_min; +uniform float initial_linear_velocity_max; +uniform float directional_velocity_min; +uniform float directional_velocity_max; +uniform float angular_velocity_min; +uniform float angular_velocity_max; +uniform float orbit_velocity_min; +uniform float orbit_velocity_max; +uniform float radial_velocity_min; +uniform float radial_velocity_max; +uniform float linear_accel_min; +uniform float linear_accel_max; +uniform float radial_accel_min; +uniform float radial_accel_max; +uniform float tangent_accel_min; +uniform float tangent_accel_max; +uniform float damping_min; +uniform float damping_max; +uniform float initial_angle_min; +uniform float initial_angle_max; +uniform float scale_min; +uniform float scale_max; +uniform float hue_variation_min; +uniform float hue_variation_max; +uniform float anim_speed_min; +uniform float anim_speed_max; +uniform float anim_offset_min; +uniform float anim_offset_max; +uniform float lifetime_randomness; +uniform vec3 emission_shape_offset = vec3(0.0); +uniform vec3 emission_shape_scale = vec3(1.0); +uniform vec3 velocity_pivot = vec3(0.0); +uniform vec4 color_value : source_color; +uniform vec3 gravity; +uniform sampler2D color_ramp : repeat_disable; +uniform float turbulence_noise_strength; +uniform float turbulence_noise_scale; +uniform float turbulence_influence_min; +uniform float turbulence_influence_max; +uniform float turbulence_initial_displacement_min; +uniform float turbulence_initial_displacement_max; +uniform float turbulence_noise_speed_random; +uniform vec3 turbulence_noise_speed = vec3(1.0, 1.0, 1.0); + +// Functions for 3D noise / turbulence. +vec4 grad(vec4 p) { + p = fract(vec4( + dot(p, vec4(0.143081, 0.001724, 0.280166, 0.262771)), + dot(p, vec4(0.645401, -0.047791, -0.146698, 0.595016)), + dot(p, vec4(-0.499665, -0.095734, 0.425674, -0.207367)), + dot(p, vec4(-0.013596, -0.848588, 0.423736, 0.17044)))); + return fract((p.xyzw * p.yzwx) * 2365.952041) * 2.0 - 1.0; +} + +float noise(vec4 coord) { + // Domain rotation to improve the look of XYZ slices + animation patterns. + coord = vec4( + coord.xyz + dot(coord, vec4(vec3(-0.1666667), -0.5)), + dot(coord, vec4(0.5))); + + vec4 base = floor(coord), delta = coord - base; + + vec4 grad_0000 = grad(base + vec4(0.0, 0.0, 0.0, 0.0)), grad_1000 = grad(base + vec4(1.0, 0.0, 0.0, 0.0)); + vec4 grad_0100 = grad(base + vec4(0.0, 1.0, 0.0, 0.0)), grad_1100 = grad(base + vec4(1.0, 1.0, 0.0, 0.0)); + vec4 grad_0010 = grad(base + vec4(0.0, 0.0, 1.0, 0.0)), grad_1010 = grad(base + vec4(1.0, 0.0, 1.0, 0.0)); + vec4 grad_0110 = grad(base + vec4(0.0, 1.0, 1.0, 0.0)), grad_1110 = grad(base + vec4(1.0, 1.0, 1.0, 0.0)); + vec4 grad_0001 = grad(base + vec4(0.0, 0.0, 0.0, 1.0)), grad_1001 = grad(base + vec4(1.0, 0.0, 0.0, 1.0)); + vec4 grad_0101 = grad(base + vec4(0.0, 1.0, 0.0, 1.0)), grad_1101 = grad(base + vec4(1.0, 1.0, 0.0, 1.0)); + vec4 grad_0011 = grad(base + vec4(0.0, 0.0, 1.0, 1.0)), grad_1011 = grad(base + vec4(1.0, 0.0, 1.0, 1.0)); + vec4 grad_0111 = grad(base + vec4(0.0, 1.0, 1.0, 1.0)), grad_1111 = grad(base + vec4(1.0, 1.0, 1.0, 1.0)); + + vec4 result_0123 = vec4( + dot(delta - vec4(0.0, 0.0, 0.0, 0.0), grad_0000), dot(delta - vec4(1.0, 0.0, 0.0, 0.0), grad_1000), + dot(delta - vec4(0.0, 1.0, 0.0, 0.0), grad_0100), dot(delta - vec4(1.0, 1.0, 0.0, 0.0), grad_1100)); + vec4 result_4567 = vec4( + dot(delta - vec4(0.0, 0.0, 1.0, 0.0), grad_0010), dot(delta - vec4(1.0, 0.0, 1.0, 0.0), grad_1010), + dot(delta - vec4(0.0, 1.0, 1.0, 0.0), grad_0110), dot(delta - vec4(1.0, 1.0, 1.0, 0.0), grad_1110)); + vec4 result_89AB = vec4( + dot(delta - vec4(0.0, 0.0, 0.0, 1.0), grad_0001), dot(delta - vec4(1.0, 0.0, 0.0, 1.0), grad_1001), + dot(delta - vec4(0.0, 1.0, 0.0, 1.0), grad_0101), dot(delta - vec4(1.0, 1.0, 0.0, 1.0), grad_1101)); + vec4 result_CDEF = vec4( + dot(delta - vec4(0.0, 0.0, 1.0, 1.0), grad_0011), dot(delta - vec4(1.0, 0.0, 1.0, 1.0), grad_1011), + dot(delta - vec4(0.0, 1.0, 1.0, 1.0), grad_0111), dot(delta - vec4(1.0, 1.0, 1.0, 1.0), grad_1111)); + + vec4 fade = delta * delta * delta * (10.0 + delta * (-15.0 + delta * 6.0)); + vec4 result_W0 = mix(result_0123, result_89AB, fade.w), result_W1 = mix(result_4567, result_CDEF, fade.w); + vec4 result_WZ = mix(result_W0, result_W1, fade.z); + vec2 result_WZY = mix(result_WZ.xy, result_WZ.zw, fade.y); + return mix(result_WZY.x, result_WZY.y, fade.x); +} + +// Curl 3D and three-noise function with friendly permission by Isaac Cohen. +// Modified to accept 4D noise. +vec3 noise_3x(vec4 p) { + float s = noise(p); + float s1 = noise(p + vec4(vec3(0.0), 1.7320508 * 2048.333333)); + float s2 = noise(p - vec4(vec3(0.0), 1.7320508 * 2048.333333)); + vec3 c = vec3(s, s1, s2); + return c; +} + +vec3 curl_3d(vec4 p, float c) { + float epsilon = 0.001 + c; + vec4 dx = vec4(epsilon, 0.0, 0.0, 0.0); + vec4 dy = vec4(0.0, epsilon, 0.0, 0.0); + vec4 dz = vec4(0.0, 0.0, epsilon, 0.0); + vec3 x0 = noise_3x(p - dx).xyz; + vec3 x1 = noise_3x(p + dx).xyz; + vec3 y0 = noise_3x(p - dy).xyz; + vec3 y1 = noise_3x(p + dy).xyz; + vec3 z0 = noise_3x(p - dz).xyz; + vec3 z1 = noise_3x(p + dz).xyz; + float x = (y1.z - y0.z) - (z1.y - z0.y); + float y = (z1.x - z0.x) - (x1.z - x0.z); + float z = (x1.y - x0.y) - (y1.x - y0.x); + return normalize(vec3(x, y, z)); +} + +vec3 get_noise_direction(vec3 pos) { + float adj_contrast = max((turbulence_noise_strength - 1.0), 0.0) * 70.0; + vec4 noise_time = TIME * vec4(turbulence_noise_speed, turbulence_noise_speed_random); + vec4 noise_pos = vec4(pos * turbulence_noise_scale, 0.0); + vec3 noise_direction = curl_3d(noise_pos + noise_time, adj_contrast); + noise_direction = mix(0.9 * noise_direction, noise_direction, turbulence_noise_strength - 9.0); + return noise_direction; +} + +vec4 rotate_hue(vec4 current_color, float hue_rot_angle) { + float hue_rot_c = cos(hue_rot_angle); + float hue_rot_s = sin(hue_rot_angle); + mat4 hue_rot_mat = + mat4(vec4(0.299, 0.587, 0.114, 0.0), + vec4(0.299, 0.587, 0.114, 0.0), + vec4(0.299, 0.587, 0.114, 0.0), + vec4(0.000, 0.000, 0.000, 1.0)) + + mat4(vec4(0.701, -0.587, -0.114, 0.0), + vec4(-0.299, 0.413, -0.114, 0.0), + vec4(-0.300, -0.588, 0.886, 0.0), + vec4(0.000, 0.000, 0.000, 0.0)) * + hue_rot_c + + mat4(vec4(0.168, 0.330, -0.497, 0.0), + vec4(-0.328, 0.035, 0.292, 0.0), + vec4(1.250, -1.050, -0.203, 0.0), + vec4(0.000, 0.000, 0.000, 0.0)) * + hue_rot_s; + return hue_rot_mat * current_color; +} + +float rand_from_seed(inout uint seed) { + int k; + int s = int(seed); + if (s == 0) { + s = 305420679; + } + k = s / 127773; + s = 16807 * (s - k * 127773) - 2836 * k; + if (s < 0) { + s += 2147483647; + } + seed = uint(s); + return float(seed % uint(65536)) / 65535.0; +} + +float rand_from_seed_m1_p1(inout uint seed) { + return rand_from_seed(seed) * 2.0 - 1.0; +} + +uint hash(uint x) { + x = ((x >> uint(16)) ^ x) * uint(73244475); + x = ((x >> uint(16)) ^ x) * uint(73244475); + x = (x >> uint(16)) ^ x; + return x; +} + +struct DisplayParameters { + vec3 scale; + float hue_rotation; + float animation_speed; + float animation_offset; + float lifetime; + vec4 color; +}; + +struct DynamicsParameters { + float angle; + float angular_velocity; + float initial_velocity_multiplier; + float directional_velocity; + float radial_velocity; + float orbit_velocity; + float turb_influence; +}; + +struct PhysicalParameters { + float linear_accel; + float radial_accel; + float tangent_accel; + float damping; +}; + +void calculate_initial_physical_params(inout PhysicalParameters params, inout uint alt_seed) { + params.linear_accel = mix(linear_accel_min, linear_accel_max, rand_from_seed(alt_seed)); + params.radial_accel = mix(radial_accel_min, radial_accel_max, rand_from_seed(alt_seed)); + params.tangent_accel = mix(tangent_accel_min, tangent_accel_max, rand_from_seed(alt_seed)); + params.damping = mix(damping_min, damping_max, rand_from_seed(alt_seed)); +} + +void calculate_initial_dynamics_params(inout DynamicsParameters params, inout uint alt_seed) { + // -------------------- DO NOT REORDER OPERATIONS, IT BREAKS VISUAL COMPATIBILITY + // -------------------- ADD NEW OPERATIONS AT THE BOTTOM + params.angle = mix(initial_angle_min, initial_angle_max, rand_from_seed(alt_seed)); + params.angular_velocity = mix(angular_velocity_min, angular_velocity_max, rand_from_seed(alt_seed)); + params.initial_velocity_multiplier = mix(initial_linear_velocity_min, initial_linear_velocity_max, rand_from_seed(alt_seed)); + params.directional_velocity = mix(directional_velocity_min, directional_velocity_max, rand_from_seed(alt_seed)); + params.radial_velocity = mix(radial_velocity_min, radial_velocity_max, rand_from_seed(alt_seed)); + params.orbit_velocity = mix(orbit_velocity_min, orbit_velocity_max, rand_from_seed(alt_seed)); + params.turb_influence = mix(turbulence_influence_min, turbulence_influence_max, rand_from_seed(alt_seed)); +} + +void calculate_initial_display_params(inout DisplayParameters params, inout uint alt_seed) { + // -------------------- DO NOT REORDER OPERATIONS, IT BREAKS VISUAL COMPATIBILITY + // -------------------- ADD NEW OPERATIONS AT THE BOTTOM + float pi = 3.14159; + params.scale = vec3(mix(scale_min, scale_max, rand_from_seed(alt_seed))); + params.scale = sign(params.scale) * max(abs(params.scale), 0.001); + params.hue_rotation = pi * 2.0 * mix(hue_variation_min, hue_variation_max, rand_from_seed(alt_seed)); + params.animation_speed = mix(anim_speed_min, anim_speed_max, rand_from_seed(alt_seed)); + params.animation_offset = mix(anim_offset_min, anim_offset_max, rand_from_seed(alt_seed)); + params.lifetime = (1.0 - lifetime_randomness * rand_from_seed(alt_seed)); + params.color = color_value; +} + +void process_display_param(inout DisplayParameters parameters, float lifetime) { + // Compile-time add textures. + parameters.color *= texture(color_ramp, vec2(lifetime)); + parameters.color = rotate_hue(parameters.color, parameters.hue_rotation); +} + +vec3 calculate_initial_position(inout uint alt_seed) { + float pi = 3.14159; + vec3 pos = vec3(0.0); + { // Emission shape. + pos = vec3(0.0); + } + return pos * emission_shape_scale + emission_shape_offset; +} + +vec3 get_random_direction_from_spread(inout uint alt_seed, float spread_angle) { + float pi = 3.14159; + float degree_to_rad = pi / 180.0; + float spread_rad = spread_angle * degree_to_rad; + float angle1_rad = rand_from_seed_m1_p1(alt_seed) * spread_rad; + float angle2_rad = rand_from_seed_m1_p1(alt_seed) * spread_rad * (1.0 - flatness); + vec3 direction_xz = vec3(sin(angle1_rad), 0.0, cos(angle1_rad)); + vec3 direction_yz = vec3(0.0, sin(angle2_rad), cos(angle2_rad)); + direction_yz.z = direction_yz.z / max(0.0001, sqrt(abs(direction_yz.z))); // Better uniform distribution. + vec3 spread_direction = vec3(direction_xz.x * direction_yz.z, direction_yz.y, direction_xz.z * direction_yz.z); + vec3 direction_nrm = length(direction) > 0.0 ? normalize(direction) : vec3(0.0, 0.0, 1.0); + // Rotate spread to direction. + vec3 binormal = cross(vec3(0.0, 1.0, 0.0), direction_nrm); + if (length(binormal) < 0.0001) { + // Direction is parallel to Y. Choose Z as the binormal. + binormal = vec3(0.0, 0.0, 1.0); + } + binormal = normalize(binormal); + vec3 normal = cross(binormal, direction_nrm); + spread_direction = binormal * spread_direction.x + normal * spread_direction.y + direction_nrm * spread_direction.z; + return normalize(spread_direction); +} + +vec3 process_radial_displacement(DynamicsParameters param, float lifetime, inout uint alt_seed, mat4 transform, mat4 emission_transform, float delta) { + vec3 radial_displacement = vec3(0.0); + if (delta < 0.001) { + return radial_displacement; + } + float radial_displacement_multiplier = 1.0; + vec3 global_pivot = (emission_transform * vec4(velocity_pivot, 1.0)).xyz; + if (length(transform[3].xyz - global_pivot) > 0.01) { + radial_displacement = normalize(transform[3].xyz - global_pivot) * radial_displacement_multiplier * param.radial_velocity; + } else { + radial_displacement = get_random_direction_from_spread(alt_seed, 360.0) * param.radial_velocity; + } + if (radial_displacement_multiplier * param.radial_velocity < 0.0) { + // Prevent inwards velocity to flicker once the point is reached. + radial_displacement = normalize(radial_displacement) * min(abs(radial_displacement_multiplier * param.radial_velocity), length(transform[3].xyz - global_pivot) / delta); + } + return radial_displacement; +} + +void process_physical_parameters(inout PhysicalParameters params, float lifetime_percent) { +} + +void start() { + uint base_number = NUMBER; + uint alt_seed = hash(base_number + uint(1) + RANDOM_SEED); + DisplayParameters params; + calculate_initial_display_params(params, alt_seed); + // Reset alt seed? + //alt_seed = hash(base_number + uint(1) + RANDOM_SEED); + DynamicsParameters dynamic_params; + calculate_initial_dynamics_params(dynamic_params, alt_seed); + PhysicalParameters physics_params; + calculate_initial_physical_params(physics_params, alt_seed); + process_display_param(params, 0.0); + if (rand_from_seed(alt_seed) > AMOUNT_RATIO) { + ACTIVE = false; + } + + if (RESTART_CUSTOM) { + CUSTOM = vec4(0.0); + CUSTOM.w = params.lifetime; + CUSTOM.x = dynamic_params.angle; + } + if (RESTART_COLOR) { + COLOR = params.color; + } + if (RESTART_ROT_SCALE) { + TRANSFORM[0].xyz = vec3(1.0, 0.0, 0.0); + TRANSFORM[1].xyz = vec3(0.0, 1.0, 0.0); + TRANSFORM[2].xyz = vec3(0.0, 0.0, 1.0); + } + if (RESTART_POSITION) { + TRANSFORM[3].xyz = calculate_initial_position(alt_seed); + float initial_turbulence_displacement = mix(turbulence_initial_displacement_min, turbulence_initial_displacement_max, rand_from_seed(alt_seed)); + vec3 noise_direction = get_noise_direction(TRANSFORM[3].xyz); + TRANSFORM[3].xyz += noise_direction * initial_turbulence_displacement; + TRANSFORM = EMISSION_TRANSFORM * TRANSFORM; + } + if (RESTART_VELOCITY) { + VELOCITY = get_random_direction_from_spread(alt_seed, spread) * dynamic_params.initial_velocity_multiplier; + } + + process_display_param(params, 0.0); + + VELOCITY = (EMISSION_TRANSFORM * vec4(VELOCITY, 0.0)).xyz; + VELOCITY += EMITTER_VELOCITY * inherit_emitter_velocity_ratio; +} + +void process() { + uint base_number = NUMBER; + //if (repeatable) { + // base_number = INDEX; + //} + uint alt_seed = hash(base_number + uint(1) + RANDOM_SEED); + DisplayParameters params; + calculate_initial_display_params(params, alt_seed); + DynamicsParameters dynamic_params; + calculate_initial_dynamics_params(dynamic_params, alt_seed); + PhysicalParameters physics_params; + calculate_initial_physical_params(physics_params, alt_seed); + + float pi = 3.14159; + float degree_to_rad = pi / 180.0; + + CUSTOM.y += DELTA / LIFETIME; + CUSTOM.y = mix(CUSTOM.y, 1.0, INTERPOLATE_TO_END); + float lifetime_percent = CUSTOM.y / params.lifetime; + if (CUSTOM.y > CUSTOM.w) { + ACTIVE = false; + } + + // Calculate all velocity. + vec3 controlled_displacement = vec3(0.0); + controlled_displacement += process_radial_displacement(dynamic_params, lifetime_percent, alt_seed, TRANSFORM, EMISSION_TRANSFORM, DELTA); + + process_physical_parameters(physics_params, lifetime_percent); + vec3 force; + { + // Copied from previous version. + vec3 pos = TRANSFORM[3].xyz; + force = gravity; + // Apply linear acceleration. + force += length(VELOCITY) > 0.0 ? normalize(VELOCITY) * physics_params.linear_accel : vec3(0.0); + // Apply radial acceleration. + vec3 org = EMISSION_TRANSFORM[3].xyz; + vec3 diff = pos - org; + force += length(diff) > 0.0 ? normalize(diff) * physics_params.radial_accel : vec3(0.0); + // Apply tangential acceleration. + float tangent_accel_val = physics_params.tangent_accel; + vec3 crossDiff = cross(normalize(diff), normalize(gravity)); + force += length(crossDiff) > 0.0 ? normalize(crossDiff) * tangent_accel_val : vec3(0.0); + force += ATTRACTOR_FORCE; + // Apply attractor forces. + VELOCITY += force * DELTA; + } + { + // Copied from previous version. + if (physics_params.damping > 0.0) { + float v = length(VELOCITY); + v -= physics_params.damping * DELTA; + if (v < 0.0) { + VELOCITY = vec3(0.0); + } else { + VELOCITY = normalize(VELOCITY) * v; + } + } + } + + // Turbulence before limiting. + float turbulence_influence = 1.0; + + vec3 noise_direction = get_noise_direction(TRANSFORM[3].xyz); + { + float vel_mag = length(VELOCITY); + float vel_infl = clamp(dynamic_params.turb_influence * turbulence_influence, 0.0, 1.0); + VELOCITY = mix(VELOCITY, normalize(noise_direction) * vel_mag * (1.0 + (1.0 - vel_infl) * 0.2), vel_infl); + vel_mag = length(controlled_displacement); + controlled_displacement = mix(controlled_displacement, normalize(noise_direction) * vel_mag * (1.0 + (1.0 - vel_infl) * 0.2), vel_infl); + } + vec3 final_velocity = controlled_displacement + VELOCITY; + + TRANSFORM[3].xyz += final_velocity * DELTA; + + process_display_param(params, lifetime_percent); + + float base_angle = dynamic_params.angle; + base_angle += CUSTOM.y * LIFETIME * dynamic_params.angular_velocity; + CUSTOM.x = base_angle * degree_to_rad; + COLOR = params.color; + + TRANSFORM[0].xyz = normalize(TRANSFORM[0].xyz); + TRANSFORM[1].xyz = normalize(TRANSFORM[1].xyz); + TRANSFORM[2].xyz = normalize(TRANSFORM[2].xyz); + TRANSFORM[0].xyz *= sign(params.scale.x) * max(abs(params.scale.x), 0.001); + TRANSFORM[1].xyz *= sign(params.scale.y) * max(abs(params.scale.y), 0.001); + TRANSFORM[2].xyz *= sign(params.scale.z) * max(abs(params.scale.z), 0.001); + + CUSTOM.z = params.animation_offset + lifetime_percent * params.animation_speed; + + if (CUSTOM.y > CUSTOM.w) { + ACTIVE = false; + } +} diff --git a/scenes/world_grab_demo/proxy_collision_detector.gd b/scenes/world_grab_demo/proxy_collision_detector.gd new file mode 100644 index 0000000..f1a954b --- /dev/null +++ b/scenes/world_grab_demo/proxy_collision_detector.gd @@ -0,0 +1,90 @@ +extends Node3D + +# Exported node paths for references in the editor. +@export var real_particles_path: NodePath # The real GPUParticles3D in the scene. +@export var real_attractor_path: NodePath # The real attractor node. +@export var target_collision_box_path: NodePath # a node for the particle target, assumed to be a 1x1x1 cube around its origin. +@export var debug_label_path: NodePath # A Label node to show "Target Hit: true/false". + +# Variables to hold the real nodes. +var real_particles: GPUParticles3D +var real_attractor: Node3D +var target_collision_box: Node3D +var debug_label: Label3D + +# Cloned proxy nodes that will live in the offscreen SubViewport. +var clone_particles: GPUParticles3D +var clone_attractor: Node3D + +# The SubViewport (and its container) for offscreen rendering. +var sub_viewport_container: SubViewportContainer +var sub_viewport: SubViewport + +# Path to your special testing shader resource. +var test_shader_path := "res://scenes/world_grab_demo/particle_test.gdshader" +var test_shader: Shader +var test_shader_material: ShaderMaterial + +func _ready(): + # Get the real nodes from the exported paths. + real_particles = get_node(real_particles_path) as GPUParticles3D + real_attractor = get_node(real_attractor_path) as Node3D + target_collision_box = get_node(target_collision_box_path) as Node3D + debug_label = get_node(debug_label_path) as Label3D + + # Create a SubViewportContainer and a SubViewport. + sub_viewport_container = SubViewportContainer.new() + add_child(sub_viewport_container) + sub_viewport = SubViewport.new() + sub_viewport_container.add_child(sub_viewport) + # Set the SubViewport resolution to a very low value (2x2 pixels). + sub_viewport.size = Vector2i(2, 2) + sub_viewport.render_target_update_mode = SubViewport.UPDATE_ALWAYS + sub_viewport.own_world_3d = true + #sub_viewport.render_target_v_flip = false + + # Add a Camera3D to the SubViewport + var camera = Camera3D.new() + sub_viewport.add_child(camera) + + # Clone the particle system and attractor. Using duplicate() with default flags + # (which duplicates recursively) so that the clones have similar structure. + clone_particles = real_particles.duplicate() as GPUParticles3D + clone_attractor = real_attractor.duplicate() as Node3D + + # Add the clones to the SubViewport so they render in its world. + sub_viewport.add_child(clone_particles) + sub_viewport.add_child(clone_attractor) + + # Load the testing shader and assign it to the clone particle system. + test_shader = load(test_shader_path) + test_shader_material = ShaderMaterial.new() + test_shader_material.shader = test_shader + + # Create a copy of the draw_pass_1 mesh + var mesh_copy = clone_particles.draw_pass_1.duplicate() + clone_particles.draw_pass_1 = mesh_copy + + # Apply the shader material to the copied mesh + clone_particles.draw_pass_1.surface_set_material(0, test_shader_material) + +func _process(_delta): + # Synchronize the global transforms of the clones with the real objects. + clone_particles.global_transform = real_particles.global_transform + clone_attractor.global_transform = real_attractor.global_transform + + # update the shader parameter for the target bounds. + test_shader_material.set_shader_parameter("bbox_min", target_collision_box.global_position) + test_shader_material.set_shader_parameter("bbox_max", target_collision_box.global_position + Vector3(1, 1, 1)) + + # Get the rendered image from the SubViewport. + var viewport_tex := sub_viewport.get_texture() + if viewport_tex: + var img: Image = viewport_tex.get_image() + if img: + # Check only the first pixel in the 2x2 render output. + var col: Color = img.get_pixel(0, 0) + # Our testing shader outputs red (1,0,0) for particles inside the box. + var hit := col.r > 0.9 and col.g < 0.1 and col.b < 0.1 + # Update the debug label to show whether the target is hit. + debug_label.text = "Target Hit: " + ("Yes" if hit else "No") diff --git a/scenes/world_grab_demo/world_grab_demo.tscn b/scenes/world_grab_demo/world_grab_demo.tscn index 99df039..7a1c921 100644 --- a/scenes/world_grab_demo/world_grab_demo.tscn +++ b/scenes/world_grab_demo/world_grab_demo.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=43 format=3 uid="uid://bmmpivq57eehv"] +[gd_scene load_steps=50 format=3 uid="uid://bmmpivq57eehv"] [ext_resource type="PackedScene" uid="uid://qbmx03iibuuu" path="res://addons/godot-xr-tools/staging/scene_base.tscn" id="1_6211a"] [ext_resource type="PackedScene" uid="uid://b4kad2kuba1yn" path="res://addons/godot-xr-tools/hands/scenes/lowpoly/left_hand_low.tscn" id="2_dss28"] @@ -20,112 +20,142 @@ [ext_resource type="PackedScene" uid="uid://d3x7ha0qme5uv" path="res://scenes/world_grab_demo/objects/arena_cylinder.tscn" id="15_ghqx0"] [ext_resource type="PackedScene" uid="uid://v1ajdy8xxct3" path="res://scenes/world_grab_demo/objects/arena_wall.tscn" id="16_bar6p"] [ext_resource type="Script" path="res://addons/godot-xr-tools/objects/pickable.gd" id="20_bgctf"] +[ext_resource type="Shader" path="res://scenes/world_grab_demo/particleemission.gdshader" id="21_fpx77"] [ext_resource type="PackedScene" uid="uid://c25yxb0vt53vc" path="res://addons/godot-xr-tools/objects/grab_points/grab_point_hand_left.tscn" id="21_v207o"] [ext_resource type="PackedScene" uid="uid://ctw7nbntd5pcj" path="res://addons/godot-xr-tools/objects/grab_points/grab_point_hand_right.tscn" id="22_0w02o"] +[ext_resource type="Script" path="res://scenes/world_grab_demo/proxy_collision_detector.gd" id="25_6xc52"] -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_72kkm"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_bqnrj"] animation = &"Grip" -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_vk2ua"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_3t3os"] animation = &"Grip" -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_cxu0a"] +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_8b622"] filter_enabled = true filters = ["Armature/Skeleton3D:Little_Distal_L", "Armature/Skeleton3D:Little_Intermediate_L", "Armature/Skeleton3D:Little_Metacarpal_L", "Armature/Skeleton3D:Little_Proximal_L", "Armature/Skeleton3D:Middle_Distal_L", "Armature/Skeleton3D:Middle_Intermediate_L", "Armature/Skeleton3D:Middle_Metacarpal_L", "Armature/Skeleton3D:Middle_Proximal_L", "Armature/Skeleton3D:Ring_Distal_L", "Armature/Skeleton3D:Ring_Intermediate_L", "Armature/Skeleton3D:Ring_Metacarpal_L", "Armature/Skeleton3D:Ring_Proximal_L", "Armature/Skeleton3D:Thumb_Distal_L", "Armature/Skeleton3D:Thumb_Metacarpal_L", "Armature/Skeleton3D:Thumb_Proximal_L", "Armature/Skeleton:Little_Distal_L", "Armature/Skeleton:Little_Intermediate_L", "Armature/Skeleton:Little_Proximal_L", "Armature/Skeleton:Middle_Distal_L", "Armature/Skeleton:Middle_Intermediate_L", "Armature/Skeleton:Middle_Proximal_L", "Armature/Skeleton:Ring_Distal_L", "Armature/Skeleton:Ring_Intermediate_L", "Armature/Skeleton:Ring_Proximal_L", "Armature/Skeleton:Thumb_Distal_L", "Armature/Skeleton:Thumb_Proximal_L"] -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_bai07"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_6iumx"] animation = &"Grip 5" -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_6u2xv"] +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_s3sux"] filter_enabled = true filters = ["Armature/Skeleton3D:Index_Distal_L", "Armature/Skeleton3D:Index_Intermediate_L", "Armature/Skeleton3D:Index_Metacarpal_L", "Armature/Skeleton3D:Index_Proximal_L", "Armature/Skeleton:Index_Distal_L", "Armature/Skeleton:Index_Intermediate_L", "Armature/Skeleton:Index_Proximal_L"] -[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_exwc2"] +[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_x7e1t"] graph_offset = Vector2(-536, 11) -nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_72kkm") +nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_bqnrj") nodes/ClosedHand1/position = Vector2(-600, 300) -nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_vk2ua") +nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_3t3os") nodes/ClosedHand2/position = Vector2(-360, 300) -nodes/Grip/node = SubResource("AnimationNodeBlend2_cxu0a") +nodes/Grip/node = SubResource("AnimationNodeBlend2_8b622") nodes/Grip/position = Vector2(0, 20) -nodes/OpenHand/node = SubResource("AnimationNodeAnimation_bai07") +nodes/OpenHand/node = SubResource("AnimationNodeAnimation_6iumx") nodes/OpenHand/position = Vector2(-600, 100) -nodes/Trigger/node = SubResource("AnimationNodeBlend2_6u2xv") +nodes/Trigger/node = SubResource("AnimationNodeBlend2_s3sux") nodes/Trigger/position = Vector2(-360, 20) node_connections = [&"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1", &"output", 0, &"Grip"] -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_vgu3m"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_27rpp"] animation = &"Grip" -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_hsye2"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_v75qo"] animation = &"Grip" -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_unii2"] +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_7xn8u"] filter_enabled = true filters = ["Armature/Skeleton3D:Little_Distal_R", "Armature/Skeleton3D:Little_Intermediate_R", "Armature/Skeleton3D:Little_Metacarpal_R", "Armature/Skeleton3D:Little_Proximal_R", "Armature/Skeleton3D:Middle_Distal_R", "Armature/Skeleton3D:Middle_Intermediate_R", "Armature/Skeleton3D:Middle_Metacarpal_R", "Armature/Skeleton3D:Middle_Proximal_R", "Armature/Skeleton3D:Ring_Distal_R", "Armature/Skeleton3D:Ring_Intermediate_R", "Armature/Skeleton3D:Ring_Metacarpal_R", "Armature/Skeleton3D:Ring_Proximal_R", "Armature/Skeleton3D:Thumb_Distal_R", "Armature/Skeleton3D:Thumb_Metacarpal_R", "Armature/Skeleton3D:Thumb_Proximal_R", "Armature/Skeleton:Little_Distal_R", "Armature/Skeleton:Little_Intermediate_R", "Armature/Skeleton:Little_Proximal_R", "Armature/Skeleton:Middle_Distal_R", "Armature/Skeleton:Middle_Intermediate_R", "Armature/Skeleton:Middle_Proximal_R", "Armature/Skeleton:Ring_Distal_R", "Armature/Skeleton:Ring_Intermediate_R", "Armature/Skeleton:Ring_Proximal_R", "Armature/Skeleton:Thumb_Distal_R", "Armature/Skeleton:Thumb_Proximal_R"] -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_6k2n8"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_3x7no"] animation = &"Grip 5" -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_15qdo"] +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_qbiuo"] filter_enabled = true filters = ["Armature/Skeleton3D:Index_Distal_R", "Armature/Skeleton3D:Index_Intermediate_R", "Armature/Skeleton3D:Index_Metacarpal_R", "Armature/Skeleton3D:Index_Proximal_R", "Armature/Skeleton:Index_Distal_R", "Armature/Skeleton:Index_Intermediate_R", "Armature/Skeleton:Index_Proximal_R"] -[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_jpr7c"] +[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_oefd4"] graph_offset = Vector2(-552.664, 107.301) -nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_vgu3m") +nodes/ClosedHand1/node = SubResource("AnimationNodeAnimation_27rpp") nodes/ClosedHand1/position = Vector2(-600, 300) -nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_hsye2") +nodes/ClosedHand2/node = SubResource("AnimationNodeAnimation_v75qo") nodes/ClosedHand2/position = Vector2(-360, 300) -nodes/Grip/node = SubResource("AnimationNodeBlend2_unii2") +nodes/Grip/node = SubResource("AnimationNodeBlend2_7xn8u") nodes/Grip/position = Vector2(0, 40) -nodes/OpenHand/node = SubResource("AnimationNodeAnimation_6k2n8") +nodes/OpenHand/node = SubResource("AnimationNodeAnimation_3x7no") nodes/OpenHand/position = Vector2(-600, 100) -nodes/Trigger/node = SubResource("AnimationNodeBlend2_15qdo") +nodes/Trigger/node = SubResource("AnimationNodeBlend2_qbiuo") nodes/Trigger/position = Vector2(-360, 40) node_connections = [&"Grip", 0, &"Trigger", &"Grip", 1, &"ClosedHand2", &"Trigger", 0, &"OpenHand", &"Trigger", 1, &"ClosedHand1", &"output", 0, &"Grip"] [sub_resource type="BoxShape3D" id="BoxShape3D_gx7jx"] size = Vector3(14, 10, 14) -[sub_resource type="Gradient" id="Gradient_m4phm"] -colors = PackedColorArray(0.506462, 0.0807418, 0.824172, 1, 5, 3, 5.159, 1) +[sub_resource type="Gradient" id="Gradient_ns6ft"] +colors = PackedColorArray(0.764539, 0.208898, 0.642811, 1, 1, 1, 3, 1) -[sub_resource type="GradientTexture1D" id="GradientTexture1D_obk4e"] -gradient = SubResource("Gradient_m4phm") +[sub_resource type="GradientTexture1D" id="GradientTexture1D_s10f1"] +gradient = SubResource("Gradient_ns6ft") use_hdr = true -[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_v1x0p"] -spread = 1.706 +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_2xajy"] +resource_local_to_scene = true +emission_shape = 3 +emission_box_extents = Vector3(0.1, 0.1, 0.1) +spread = 32.23 initial_velocity_min = 1.0 -initial_velocity_max = 2.0 +initial_velocity_max = 1.0 gravity = Vector3(0, 0, 0) -scale_min = 0.01 -scale_max = 0.01 -color_ramp = SubResource("GradientTexture1D_obk4e") -hue_variation_min = -2.23517e-08 -hue_variation_max = 0.03 +color_ramp = SubResource("GradientTexture1D_s10f1") turbulence_enabled = true -turbulence_influence_min = 0.01 -turbulence_influence_max = 0.01 +turbulence_influence_min = 0.001 +turbulence_influence_max = 0.001 -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_vwnyt"] -shading_mode = 0 -vertex_color_use_as_albedo = true -vertex_color_is_srgb = true -billboard_mode = 1 -billboard_keep_scale = true +[sub_resource type="ShaderMaterial" id="ShaderMaterial_av6ib"] +render_priority = 0 +shader = ExtResource("21_fpx77") +shader_parameter/albedo = Color(1, 1, 1, 1) +shader_parameter/point_size = null +shader_parameter/roughness = 1.0 +shader_parameter/metallic_texture_channel = null +shader_parameter/specular = null +shader_parameter/metallic = null +shader_parameter/emission = Color(0.813308, 0.000389282, 0.784183, 1) +shader_parameter/emission_energy = 11.71 +shader_parameter/uv1_scale = null +shader_parameter/uv1_offset = null +shader_parameter/uv2_scale = null +shader_parameter/uv2_offset = null -[sub_resource type="QuadMesh" id="QuadMesh_vfg7v"] -material = SubResource("StandardMaterial3D_vwnyt") +[sub_resource type="QuadMesh" id="QuadMesh_avrt1"] +resource_local_to_scene = true +material = SubResource("ShaderMaterial_av6ib") +size = Vector2(0.01, 0.01) [sub_resource type="SphereShape3D" id="SphereShape3D_0m1dj"] radius = 0.1 +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_hsb4k"] +shading_mode = 2 +emission_enabled = true +emission = Color(0.164343, 0.817034, 0.864581, 1) + [sub_resource type="SphereMesh" id="SphereMesh_gbwen"] +material = SubResource("StandardMaterial3D_hsb4k") radius = 0.1 height = 0.2 +[sub_resource type="BoxMesh" id="BoxMesh_5wq8q"] + +[sub_resource type="BoxShape3D" id="BoxShape3D_bld3o"] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ucnw1"] +albedo_color = Color(0.17869, 0.476109, 0.383491, 1) +emission_enabled = true +emission = Color(0.43073, 0.00127084, 0.620365, 1) + +[sub_resource type="CapsuleMesh" id="CapsuleMesh_tq84j"] +material = SubResource("StandardMaterial3D_ucnw1") + [node name="WorldGrabDemo" instance=ExtResource("1_6211a")] [node name="XROrigin3D" parent="." index="0"] @@ -163,11 +193,12 @@ bone_idx = 9 [node name="AnimationTree" parent="XROrigin3D/LeftHand/LeftHand" index="1"] root_node = NodePath("../Hand_Nails_low_L") -tree_root = SubResource("AnimationNodeBlendTree_exwc2") +tree_root = SubResource("AnimationNodeBlendTree_x7e1t") [node name="FunctionPickup" parent="XROrigin3D/LeftHand" index="1" instance=ExtResource("3_gbd4b")] [node name="ControlPadLocationLeft" parent="XROrigin3D/LeftHand" index="2" instance=ExtResource("4_12d7t")] +visible = false [node name="RightHand" parent="XROrigin3D/RightHand" index="0" instance=ExtResource("4_xv2cc")] @@ -201,7 +232,7 @@ bone_idx = 9 [node name="AnimationTree" parent="XROrigin3D/RightHand/RightHand" index="1"] root_node = NodePath("../Hand_Nails_low_R") -tree_root = SubResource("AnimationNodeBlendTree_jpr7c") +tree_root = SubResource("AnimationNodeBlendTree_oefd4") [node name="FunctionPickup" parent="XROrigin3D/RightHand" index="1" instance=ExtResource("3_gbd4b")] @@ -316,17 +347,17 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -6) title = ExtResource("10_phcsg") [node name="GPUParticles3D" type="GPUParticles3D" parent="." index="5"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.63005, 5, 0) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.45237, 5, 0) amount = 20000 lifetime = 10.0 preprocess = 5.0 randomness = 0.18 visibility_aabb = AABB(-400, -400, -400, 400, 400, 400) -process_material = SubResource("ParticleProcessMaterial_v1x0p") -draw_pass_1 = SubResource("QuadMesh_vfg7v") +process_material = SubResource("ParticleProcessMaterial_2xajy") +draw_pass_1 = SubResource("QuadMesh_avrt1") [node name="XRToolsPickable" type="RigidBody3D" parent="." index="6"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.800494, 5.33745, -2.52209) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.09547, 0.0904029) collision_layer = 4 collision_mask = 7 gravity_scale = 0.0 @@ -341,7 +372,7 @@ shape = SubResource("SphereShape3D_0m1dj") [node name="GPUParticlesAttractorSphere3D" type="GPUParticlesAttractorSphere3D" parent="XRToolsPickable" index="1"] strength = 5.41 attenuation = 1e-05 -radius = 3.0 +radius = 43.42 [node name="GrabPointHandLeft" parent="XRToolsPickable" index="2" instance=ExtResource("21_v207o")] @@ -350,20 +381,33 @@ radius = 3.0 [node name="MeshInstance3D" type="MeshInstance3D" parent="XRToolsPickable" index="4"] mesh = SubResource("SphereMesh_gbwen") -[node name="GPUParticlesAttractorSphere3D2" type="GPUParticlesAttractorSphere3D" parent="." index="7"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 35.0482, 15.5106, -16.643) -visible = false -strength = -87.69 -attenuation = 1e-05 -radius = 41.47 +[node name="Target" type="MeshInstance3D" parent="." index="7"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, 0.5, 0.5) +mesh = SubResource("BoxMesh_5wq8q") +skeleton = NodePath("") -[node name="GPUParticlesAttractorBox3D" type="GPUParticlesAttractorBox3D" parent="." index="8"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.60537, -6.71833, -7.97522) -visible = false -strength = 128.0 -attenuation = 1e-05 -directionality = 1.0 -size = Vector3(27.4912, 26.4204, 37.1567) +[node name="CollisionShape3D" type="CollisionShape3D" parent="Target" index="0"] +shape = SubResource("BoxShape3D_bld3o") + +[node name="ProxyCollisionDetector" type="Node3D" parent="." index="8"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, 0.5, 0.5) +script = ExtResource("25_6xc52") +real_particles_path = NodePath("../GPUParticles3D") +real_attractor_path = NodePath("../XRToolsPickable/GPUParticlesAttractorSphere3D") +target_collision_box_path = NodePath("../Target/CollisionShape3D") +debug_label_path = NodePath("../Label3D") + +[node name="Label3D" type="Label3D" parent="." index="9"] +transform = Transform3D(-3.15013, 0, 2.75393e-07, 0, 3.15013, 0, -2.75393e-07, 0, -3.15013, -0.167185, 1.34727, 3.65275) +text = "sneed" + +[node name="MeshInstance3D" type="MeshInstance3D" parent="." index="10"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.12102, 2.64291) +mesh = SubResource("CapsuleMesh_tq84j") + +[node name="MeshInstance3D2" type="MeshInstance3D" parent="." index="11"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.86311, 3.12102, 2.64291) +mesh = SubResource("CapsuleMesh_tq84j") [editable path="XROrigin3D/LeftHand/LeftHand"] [editable path="XROrigin3D/LeftHand/LeftHand/Hand_Nails_low_L"]