Grunk listener model & behaviors

This commit is contained in:
Rob Kelly 2025-08-22 18:09:15 -06:00
parent 8f565cd5b0
commit 2567bff243
13 changed files with 3037 additions and 2432 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,37 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://coucghe370fff"
path="res://.godot/imported/listener.gltf-c3cfd41dd7982a61670b2b2c1d2f39f8.scn"
[deps]
source_file="res://assets/grunk/listener/listener.gltf"
dest_files=["res://.godot/imported/listener.gltf-c3cfd41dd7982a61670b2b2c1d2f39f8.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={}
gltf/naming_version=1
gltf/embedded_image_handling=1

View File

@ -330,6 +330,7 @@ mesh_instance = NodePath("../..")
source_gunk_material = SubResource("ShaderMaterial_67o2j") source_gunk_material = SubResource("ShaderMaterial_67o2j")
[node name="Puzzle" type="Node3D" parent="ListenerWall"] [node name="Puzzle" type="Node3D" parent="ListenerWall"]
transform = Transform3D(0, 4.37114e-08, 1, -4.37114e-08, 1, -4.37114e-08, -1, -4.37114e-08, 1.91069e-15, 0, 0, 0)
[node name="Listener" parent="ListenerWall/Puzzle" instance=ExtResource("12_e8utx")] [node name="Listener" parent="ListenerWall/Puzzle" instance=ExtResource("12_e8utx")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.37114e-08, 1) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.37114e-08, 1)

View File

@ -771,6 +771,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0518835, 0)
[node name="FootstepGameSoundEmitter" type="Area3D" parent="FootstepController"] [node name="FootstepGameSoundEmitter" type="Area3D" parent="FootstepController"]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
collision_layer = 0 collision_layer = 0
collision_mask = 16 collision_mask = 16
script = ExtResource("31_wcxbk") script = ExtResource("31_wcxbk")

View File

@ -4,27 +4,44 @@ extends GunkNode
signal triggered signal triggered
const JITTER_SCALE_FACTOR := 0.15
const JITTER_INFLATION_FACTOR := 1.1
@export var quick_connect_to: SignalNode: @export var quick_connect_to: SignalNode:
set = _editor_connect set = _editor_connect
# NOTE
# trigger oscillation animation was generated using the formula
# f(x) = e^(-0.25x) * cos(x * pi / 2 - pi/2) + 1 for x in {0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 20}
@onready var trigger_animation_player: AnimationPlayer = %TriggerAnimationPlayer
@onready var cooldown_timer: Timer = %CooldownTimer @onready var cooldown_timer: Timer = %CooldownTimer
@onready var listener_model: ListenerModel = %ListenerModel
@onready var ping_animation: AnimationPlayer = %PingAnimation
@onready var listener_mesh: MeshInstance3D = $ListenerModel/Armature/Skeleton3D/Listener
func _on_sound_detected(source: Vector3) -> void:
listener_model.lock_target(source)
if cooldown_timer.is_stopped():
trigger()
cooldown_timer.start()
func trigger() -> void: func trigger() -> void:
if not cooldown_timer.is_stopped():
return
# TODO play sfx # TODO play sfx
ping_animation.play("ping")
trigger_animation_player.play("trigger")
triggered.emit() triggered.emit()
cooldown_timer.start()
func _editor_connect(node: SignalNode) -> void: func _editor_connect(node: SignalNode) -> void:
triggered.connect(node.trigger, CONNECT_PERSIST) triggered.connect(node.trigger, CONNECT_PERSIST)
self.notify_property_list_changed() self.notify_property_list_changed()
func _process(delta: float) -> void:
if Engine.is_editor_hint():
return
super._process(delta)
# TODO actual model & animation
var shader: ShaderMaterial = listener_mesh.get_surface_override_material(0)
var damage := pct_damage()
shader.set_shader_parameter("jitter_time_scale", pow(damage * JITTER_SCALE_FACTOR, 1.2))
shader.set_shader_parameter("vertex_inflation", pow(damage * JITTER_INFLATION_FACTOR, 3))
# TODO pulse animation

View File

@ -1,72 +1,66 @@
[gd_scene load_steps=19 format=3 uid="uid://kctp5erogwcb"] [gd_scene load_steps=25 format=3 uid="uid://kctp5erogwcb"]
[ext_resource type="Script" uid="uid://bde7cglaqobkd" path="res://src/world/mechanics/listener/listener.gd" id="1_htscg"] [ext_resource type="Script" uid="uid://bde7cglaqobkd" path="res://src/world/mechanics/listener/listener.gd" id="1_htscg"]
[ext_resource type="Script" uid="uid://cfsiyhhrcua6o" path="res://src/world/game_sound/game_sound_listener.gd" id="2_htscg"] [ext_resource type="Script" uid="uid://cfsiyhhrcua6o" path="res://src/world/game_sound/game_sound_listener.gd" id="2_htscg"]
[ext_resource type="Texture2D" uid="uid://c31gdstf55x5" path="res://assets/particles/ping.png" id="3_2ibh1"] [ext_resource type="Texture2D" uid="uid://c31gdstf55x5" path="res://assets/particles/ping.png" id="3_2ibh1"]
[ext_resource type="PackedScene" uid="uid://c2c0ooj1re3dk" path="res://src/world/mechanics/listener/listener_model.tscn" id="3_r42ft"]
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_2ibh1"] [ext_resource type="Shader" uid="uid://ckxc0ngd37rtk" path="res://src/shaders/gunk.gdshader" id="4_pp7wn"]
data = PackedVector3Array(0, 0.05, 0.25, 0.0957, 0.05, 0.231, 0, -0.05, 0.2, 0.0957, 0.05, 0.231, 0.0765, -0.05, 0.1848, 0, -0.05, 0.2, 0.0957, 0.05, 0.231, 0.1768, 0.05, 0.1768, 0.0765, -0.05, 0.1848, 0.1768, 0.05, 0.1768, 0.1414, -0.05, 0.1414, 0.0765, -0.05, 0.1848, 0.1768, 0.05, 0.1768, 0.231, 0.05, 0.0957, 0.1414, -0.05, 0.1414, 0.231, 0.05, 0.0957, 0.1848, -0.05, 0.0765, 0.1414, -0.05, 0.1414, 0.231, 0.05, 0.0957, 0.25, 0.05, 0, 0.1848, -0.05, 0.0765, 0.25, 0.05, 0, 0.2, -0.05, 0, 0.1848, -0.05, 0.0765, 0.25, 0.05, 0, 0.231, 0.05, -0.0957, 0.2, -0.05, 0, 0.231, 0.05, -0.0957, 0.1848, -0.05, -0.0765, 0.2, -0.05, 0, 0.231, 0.05, -0.0957, 0.1768, 0.05, -0.1768, 0.1848, -0.05, -0.0765, 0.1768, 0.05, -0.1768, 0.1414, -0.05, -0.1414, 0.1848, -0.05, -0.0765, 0.1768, 0.05, -0.1768, 0.0957, 0.05, -0.231, 0.1414, -0.05, -0.1414, 0.0957, 0.05, -0.231, 0.0765, -0.05, -0.1848, 0.1414, -0.05, -0.1414, 0.0957, 0.05, -0.231, 0, 0.05, -0.25, 0.0765, -0.05, -0.1848, 0, 0.05, -0.25, 0, -0.05, -0.2, 0.0765, -0.05, -0.1848, 0, 0.05, -0.25, -0.0957, 0.05, -0.231, 0, -0.05, -0.2, -0.0957, 0.05, -0.231, -0.0765, -0.05, -0.1848, 0, -0.05, -0.2, -0.0957, 0.05, -0.231, -0.1768, 0.05, -0.1768, -0.0765, -0.05, -0.1848, -0.1768, 0.05, -0.1768, -0.1414, -0.05, -0.1414, -0.0765, -0.05, -0.1848, -0.1768, 0.05, -0.1768, -0.231, 0.05, -0.0957, -0.1414, -0.05, -0.1414, -0.231, 0.05, -0.0957, -0.1848, -0.05, -0.0765, -0.1414, -0.05, -0.1414, -0.231, 0.05, -0.0957, -0.25, 0.05, 0, -0.1848, -0.05, -0.0765, -0.25, 0.05, 0, -0.2, -0.05, 0, -0.1848, -0.05, -0.0765, -0.25, 0.05, 0, -0.231, 0.05, 0.0957, -0.2, -0.05, 0, -0.231, 0.05, 0.0957, -0.1848, -0.05, 0.0765, -0.2, -0.05, 0, -0.231, 0.05, 0.0957, -0.1768, 0.05, 0.1768, -0.1848, -0.05, 0.0765, -0.1768, 0.05, 0.1768, -0.1414, -0.05, 0.1414, -0.1848, -0.05, 0.0765, -0.1768, 0.05, 0.1768, -0.0957, 0.05, 0.231, -0.1414, -0.05, 0.1414, -0.0957, 0.05, 0.231, -0.0765, -0.05, 0.1848, -0.1414, -0.05, 0.1414, -0.0957, 0.05, 0.231, 0, 0.05, 0.25, -0.0765, -0.05, 0.1848, 0, 0.05, 0.25, 0, -0.05, 0.2, -0.0765, -0.05, 0.1848, 0, 0.05, 0, 0.0957, 0.05, 0.231, 0, 0.05, 0.25, 0, 0.05, 0, 0.1768, 0.05, 0.1768, 0.0957, 0.05, 0.231, 0, 0.05, 0, 0.231, 0.05, 0.0957, 0.1768, 0.05, 0.1768, 0, 0.05, 0, 0.25, 0.05, 0, 0.231, 0.05, 0.0957, 0, 0.05, 0, 0.231, 0.05, -0.0957, 0.25, 0.05, 0, 0, 0.05, 0, 0.1768, 0.05, -0.1768, 0.231, 0.05, -0.0957, 0, 0.05, 0, 0.0957, 0.05, -0.231, 0.1768, 0.05, -0.1768, 0, 0.05, 0, 0, 0.05, -0.25, 0.0957, 0.05, -0.231, 0, 0.05, 0, -0.0957, 0.05, -0.231, 0, 0.05, -0.25, 0, 0.05, 0, -0.1768, 0.05, -0.1768, -0.0957, 0.05, -0.231, 0, 0.05, 0, -0.231, 0.05, -0.0957, -0.1768, 0.05, -0.1768, 0, 0.05, 0, -0.25, 0.05, 0, -0.231, 0.05, -0.0957, 0, 0.05, 0, -0.231, 0.05, 0.0957, -0.25, 0.05, 0, 0, 0.05, 0, -0.1768, 0.05, 0.1768, -0.231, 0.05, 0.0957, 0, 0.05, 0, -0.0957, 0.05, 0.231, -0.1768, 0.05, 0.1768, 0, 0.05, 0, 0, 0.05, 0.25, -0.0957, 0.05, 0.231, 0, -0.05, 0, 0, -0.05, 0.2, 0.0765, -0.05, 0.1848, 0, -0.05, 0, 0.0765, -0.05, 0.1848, 0.1414, -0.05, 0.1414, 0, -0.05, 0, 0.1414, -0.05, 0.1414, 0.1848, -0.05, 0.0765, 0, -0.05, 0, 0.1848, -0.05, 0.0765, 0.2, -0.05, 0, 0, -0.05, 0, 0.2, -0.05, 0, 0.1848, -0.05, -0.0765, 0, -0.05, 0, 0.1848, -0.05, -0.0765, 0.1414, -0.05, -0.1414, 0, -0.05, 0, 0.1414, -0.05, -0.1414, 0.0765, -0.05, -0.1848, 0, -0.05, 0, 0.0765, -0.05, -0.1848, 0, -0.05, -0.2, 0, -0.05, 0, 0, -0.05, -0.2, -0.0765, -0.05, -0.1848, 0, -0.05, 0, -0.0765, -0.05, -0.1848, -0.1414, -0.05, -0.1414, 0, -0.05, 0, -0.1414, -0.05, -0.1414, -0.1848, -0.05, -0.0765, 0, -0.05, 0, -0.1848, -0.05, -0.0765, -0.2, -0.05, 0, 0, -0.05, 0, -0.2, -0.05, 0, -0.1848, -0.05, 0.0765, 0, -0.05, 0, -0.1848, -0.05, 0.0765, -0.1414, -0.05, 0.1414, 0, -0.05, 0, -0.1414, -0.05, 0.1414, -0.0765, -0.05, 0.1848, 0, -0.05, 0, -0.0765, -0.05, 0.1848, 0, -0.05, 0.2) [ext_resource type="Texture2D" uid="uid://cm1jrvx7ftx4c" path="res://assets/black.png" id="5_c5snp"]
[ext_resource type="FastNoiseLite" uid="uid://cnlvdtx68giv6" path="res://assets/materials/gunk_noise.tres" id="6_m4i7y"]
[sub_resource type="SphereShape3D" id="SphereShape3D_2ibh1"] [sub_resource type="SphereShape3D" id="SphereShape3D_2ibh1"]
radius = 1.0 radius = 1.0
[sub_resource type="CylinderMesh" id="CylinderMesh_ud3xk"] [sub_resource type="NoiseTexture3D" id="NoiseTexture3D_2roq2"]
top_radius = 0.25 width = 256
bottom_radius = 0.2 height = 256
height = 0.1 depth = 32
radial_segments = 16 seamless = true
rings = 0 seamless_blend_skirt = 0.5
noise = ExtResource("6_m4i7y")
[sub_resource type="Animation" id="Animation_2ibh1"] [sub_resource type="NoiseTexture3D" id="NoiseTexture3D_fk1xc"]
length = 0.001 width = 256
tracks/0/type = "value" height = 256
tracks/0/imported = false depth = 32
tracks/0/enabled = true seamless = true
tracks/0/path = NodePath("CollisionShape3D:scale") seamless_blend_skirt = 0.5
tracks/0/interp = 1 noise = ExtResource("6_m4i7y")
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector3(1, 1, 1)]
}
[sub_resource type="Animation" id="Animation_htscg"] [sub_resource type="FastNoiseLite" id="FastNoiseLite_7fplw"]
resource_name = "trigger" frequency = 0.0703
length = 2.0
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("CollisionShape3D:scale")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.3, 0.5, 0.7, 0.9, 1.1, 1.3, 1.5, 1.7, 1.9, 2),
"transitions": PackedFloat32Array(0.618, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 0,
"values": [Vector3(1, 1, 1), Vector3(1.779, 1.779, 1.779), Vector3(0.528, 0.528, 0.528), Vector3(1.287, 1.287, 1.287), Vector3(0.826, 0.826, 0.826), Vector3(1.105, 1.105, 1.105), Vector3(0.936, 0.936, 0.936), Vector3(1.039, 1.039, 1.039), Vector3(0.976, 0.976, 0.976), Vector3(1.014, 1.014, 1.014), Vector3(0.991, 0.991, 0.991), Vector3(1, 1, 1)]
}
tracks/1/type = "method"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("PingEffect/PingAnimation")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [&"ping", -1, 1.0, false],
"method": &"play"
}]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_2ibh1"] [sub_resource type="NoiseTexture3D" id="NoiseTexture3D_omayi"]
_data = { width = 32
&"RESET": SubResource("Animation_2ibh1"), height = 32
&"trigger": SubResource("Animation_htscg") depth = 128
} noise = SubResource("FastNoiseLite_7fplw")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_yuift"]
resource_local_to_scene = true
render_priority = 0
shader = ExtResource("4_pp7wn")
shader_parameter/color_1 = Color(0, 0.03, 0.1, 1)
shader_parameter/color_2 = Color(0, 0.1, 0.3, 1)
shader_parameter/emission_color = Color(0.25, 0.88, 1, 1)
shader_parameter/pixellation = 128.0
shader_parameter/time_pixellation = 30.0
shader_parameter/roughness = 0.15
shader_parameter/specular_contribution = 0.8
shader_parameter/emission_strength = 0.02
shader_parameter/normal_scale = 1.0
shader_parameter/uv_scale = Vector2(2, 2)
shader_parameter/time_scale = 0.2
shader_parameter/edge_bleed = 0.25
shader_parameter/gunk_mask = ExtResource("5_c5snp")
shader_parameter/gunk_noise = SubResource("NoiseTexture3D_2roq2")
shader_parameter/gunk_normal_map = SubResource("NoiseTexture3D_fk1xc")
shader_parameter/jitter_magnitude = 0.4
shader_parameter/jitter_time_scale = 0.1
shader_parameter/jitter_noise = SubResource("NoiseTexture3D_omayi")
shader_parameter/vertex_inflation = 0.0
shader_parameter/inflation_pixellation = 10.0
shader_parameter/overlay_emission_scale = 1.0
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_2ibh1"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_2ibh1"]
resource_local_to_scene = true resource_local_to_scene = true
@ -348,6 +342,14 @@ _data = {
&"ping": SubResource("Animation_r42ft") &"ping": SubResource("Animation_r42ft")
} }
[sub_resource type="CylinderShape3D" id="CylinderShape3D_dqq13"]
height = 0.28
radius = 0.125
[sub_resource type="CylinderShape3D" id="CylinderShape3D_r42ft"]
height = 0.1
radius = 0.175
[node name="Listener" type="StaticBody3D" groups=["Persistent"]] [node name="Listener" type="StaticBody3D" groups=["Persistent"]]
collision_layer = 36 collision_layer = 36
collision_mask = 0 collision_mask = 0
@ -356,41 +358,35 @@ durability = 3.0
value = 4000.0 value = 4000.0
metadata/_custom_type_script = "uid://bypgxi0gy56yk" metadata/_custom_type_script = "uid://bypgxi0gy56yk"
[node name="CollisionShape3D" type="CollisionShape3D" parent="."] [node name="GameSoundListener" type="StaticBody3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.05, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.05, 0)
shape = SubResource("ConcavePolygonShape3D_2ibh1")
[node name="GameSoundListener" type="StaticBody3D" parent="CollisionShape3D"]
collision_layer = 16 collision_layer = 16
collision_mask = 0 collision_mask = 0
script = ExtResource("2_htscg") script = ExtResource("2_htscg")
metadata/_custom_type_script = "uid://cfsiyhhrcua6o" metadata/_custom_type_script = "uid://cfsiyhhrcua6o"
[node name="CollisionShape3D" type="CollisionShape3D" parent="CollisionShape3D/GameSoundListener"] [node name="CollisionShape3D" type="CollisionShape3D" parent="GameSoundListener"]
shape = SubResource("SphereShape3D_2ibh1") shape = SubResource("SphereShape3D_2ibh1")
[node name="MeshInstance3D" type="MeshInstance3D" parent="CollisionShape3D"] [node name="ListenerModel" parent="." instance=ExtResource("3_r42ft")]
gi_mode = 2
mesh = SubResource("CylinderMesh_ud3xk")
skeleton = NodePath("../..")
[node name="Label3D" type="Label3D" parent="CollisionShape3D/MeshInstance3D"]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0.051, 0)
pixel_size = 0.001
text = "LISTENER"
font_size = 92
outline_size = 20
[node name="CooldownTimer" type="Timer" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
wait_time = 4.0 transform = Transform3D(0.8, 0, 0, 0, 0.8, 0, 0, 0, 0.8, 0, 0, 0)
one_shot = true
[node name="TriggerAnimationPlayer" type="AnimationPlayer" parent="."] [node name="Listener" parent="ListenerModel/Armature/Skeleton3D" index="0"]
unique_name_in_owner = true surface_material_override/0 = SubResource("ShaderMaterial_yuift")
libraries = {
&"": SubResource("AnimationLibrary_2ibh1") [node name="PhysicalBoneSimulator3D" type="PhysicalBoneSimulator3D" parent="ListenerModel/Armature/Skeleton3D" index="6"]
}
[node name="PhysicalBone3D" type="PhysicalBone3D" parent="ListenerModel/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
transform = Transform3D(0.323526, 1.18154e-06, 1.20741, -1.0665e-08, 1.25, -1.22036e-06, -1.20741, 3.05553e-07, 0.323526, -4.82718e-06, 0.800007, -1.2209e-06)
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.4398e-08, -5.86509e-06, 3.98532e-06)
body_offset = Transform3D(1.25, 1.11734e-08, -2.47359e-06, -1.11759e-08, 1.25, -1.23028e-06, 2.47359e-06, 1.23028e-06, 1.25, -6.79876e-08, 7.33137e-06, -4.98165e-06)
bone_name = "Stem5"
[node name="RemoteTransform3D" type="RemoteTransform3D" parent="ListenerModel/Armature/Skeleton3D/PhysicalBoneSimulator3D/PhysicalBone3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.235, 0)
remote_path = NodePath("../../../../../../CollisionShape3D2")
update_scale = false
[node name="PingEffect" type="Node3D" parent="."] [node name="PingEffect" type="Node3D" parent="."]
@ -416,8 +412,25 @@ mesh = SubResource("QuadMesh_c5snp")
skeleton = NodePath("../..") skeleton = NodePath("../..")
[node name="PingAnimation" type="AnimationPlayer" parent="PingEffect"] [node name="PingAnimation" type="AnimationPlayer" parent="PingEffect"]
unique_name_in_owner = true
libraries = { libraries = {
&"": SubResource("AnimationLibrary_dqq13") &"": SubResource("AnimationLibrary_dqq13")
} }
[connection signal="sound_detected" from="CollisionShape3D/GameSoundListener" to="." method="trigger" unbinds=1] [node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.14, 0)
shape = SubResource("CylinderShape3D_dqq13")
[node name="CollisionShape3D2" type="CollisionShape3D" parent="."]
transform = Transform3D(0.258815, 9.45212e-07, 0.96591, -8.53181e-09, 0.999981, -9.76273e-07, -0.965905, 2.44438e-07, 0.258817, -3.63961e-06, 0.875006, -9.19277e-07)
shape = SubResource("CylinderShape3D_r42ft")
[node name="CooldownTimer" type="Timer" parent="."]
unique_name_in_owner = true
wait_time = 4.0
one_shot = true
[connection signal="sound_detected" from="GameSoundListener" to="." method="_on_sound_detected"]
[connection signal="timeout" from="CooldownTimer" to="ListenerModel" method="release_target"]
[editable path="ListenerModel"]

View File

@ -0,0 +1,32 @@
class_name ListenerModel extends Node3D
## Model controller for the Grunk Listener
const TARGET_ACCELERATION := 8.0
var _open := false
@onready var target_target: Marker3D = %TargetTarget
@onready var ik_target: Marker3D = %IKTarget
@onready var ik_animation: AnimationPlayer = %IKAnimation
func lock_target(target: Vector3) -> void:
target_target.global_position = target
if not _open:
_open = true
ik_animation.play("open")
func release_target() -> void:
if _open:
ik_animation.play("close")
_open = false
func _process(delta: float) -> void:
var weight := 1.0 - exp(-TARGET_ACCELERATION * delta)
ik_target.global_position = ik_target.global_position.lerp(
target_target.global_position, weight
)

View File

@ -0,0 +1 @@
uid://co4gkdwyhdbmc

View File

@ -0,0 +1,317 @@
[gd_scene load_steps=8 format=3 uid="uid://c2c0ooj1re3dk"]
[ext_resource type="PackedScene" uid="uid://coucghe370fff" path="res://assets/grunk/listener/listener.gltf" id="1_lgdkx"]
[ext_resource type="Script" uid="uid://co4gkdwyhdbmc" path="res://src/world/mechanics/listener/listener_model.gd" id="2_yh3g4"]
[ext_resource type="Material" uid="uid://bmab6i16v748m" path="res://assets/materials/grunk_jittery.material" id="3_xijsm"]
[sub_resource type="Animation" id="Animation_yh3g4"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Armature/Skeleton3D/StemIK1:influence")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Armature/Skeleton3D/StemIK2:influence")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("Armature/Skeleton3D/StemIK3:influence")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("Armature/Skeleton3D/StemIK4:influence")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("Armature/Skeleton3D/StemIK5:influence")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
[sub_resource type="Animation" id="Animation_xijsm"]
resource_name = "close"
length = 2.5
tracks/0/type = "animation"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("AnimationPlayer")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"clips": PackedStringArray("close"),
"times": PackedFloat32Array(0)
}
tracks/1/type = "bezier"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Armature/Skeleton3D/StemIK1:influence")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"handle_modes": PackedInt32Array(0, 0),
"points": PackedFloat32Array(1, -0.25, 0, 1, 0, 0, -0.8, 0, 0.25, 0),
"times": PackedFloat32Array(0, 1.46667)
}
tracks/2/type = "bezier"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("Armature/Skeleton3D/StemIK2:influence")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"handle_modes": PackedInt32Array(0, 0),
"points": PackedFloat32Array(1, -0.25, 0, 1.618, 0, 0, -1, 0, 0.25, 0),
"times": PackedFloat32Array(0.133333, 1.9)
}
tracks/3/type = "bezier"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("Armature/Skeleton3D/StemIK3:influence")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"handle_modes": PackedInt32Array(0, 0),
"points": PackedFloat32Array(1, -0.25, 0, 1.618, 0, 0, -1, 0, 0.25, 0),
"times": PackedFloat32Array(0.333333, 2.3)
}
tracks/4/type = "bezier"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("Armature/Skeleton3D/StemIK4:influence")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"handle_modes": PackedInt32Array(0, 0),
"points": PackedFloat32Array(1, -0.25, 0, 1, 0, 0, -1, 0, 0.25, 0),
"times": PackedFloat32Array(0.566667, 2.4)
}
tracks/5/type = "bezier"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("Armature/Skeleton3D/StemIK5:influence")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"handle_modes": PackedInt32Array(0, 0),
"points": PackedFloat32Array(1, -0.25, 0, 0.8, 0, 0, -1, 0, 0.25, 0),
"times": PackedFloat32Array(0.966667, 2.5)
}
[sub_resource type="Animation" id="Animation_lgdkx"]
resource_name = "open"
length = 0.42
tracks/0/type = "animation"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("AnimationPlayer")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"clips": PackedStringArray("open"),
"times": PackedFloat32Array(0)
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Armature/Skeleton3D/StemIK1:influence")
tracks/1/interp = 2
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.133333, 0.366667),
"transitions": PackedFloat32Array(0.618, 1),
"update": 0,
"values": [0.0, 1.0]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("Armature/Skeleton3D/StemIK2:influence")
tracks/2/interp = 2
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0.1, 0.333333),
"transitions": PackedFloat32Array(0.618, 1),
"update": 0,
"values": [0.0, 1.0]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("Armature/Skeleton3D/StemIK3:influence")
tracks/3/interp = 2
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0.0666667, 0.3),
"transitions": PackedFloat32Array(0.618, 1),
"update": 0,
"values": [0.0, 1.0]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("Armature/Skeleton3D/StemIK4:influence")
tracks/4/interp = 2
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0.0333333, 0.266667),
"transitions": PackedFloat32Array(0.618, 1),
"update": 0,
"values": [0.0, 1.0]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("Armature/Skeleton3D/StemIK5:influence")
tracks/5/interp = 2
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0, 0.233333),
"transitions": PackedFloat32Array(0.618, 1),
"update": 0,
"values": [0.0, 1.0]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_xijsm"]
_data = {
&"RESET": SubResource("Animation_yh3g4"),
&"close": SubResource("Animation_xijsm"),
&"open": SubResource("Animation_lgdkx")
}
[node name="ListenerModel" instance=ExtResource("1_lgdkx")]
script = ExtResource("2_yh3g4")
[node name="Listener" parent="Armature/Skeleton3D" index="0"]
surface_material_override/0 = ExtResource("3_xijsm")
[node name="StemIK1" type="LookAtModifier3D" parent="Armature/Skeleton3D" index="1"]
influence = 0.0
target_node = NodePath("../../../IKTarget")
bone_name = "Stem1"
bone = 0
forward_axis = 2
primary_rotation_axis = 0
duration = 0.2
transition_type = 1
use_angle_limitation = true
symmetry_limitation = true
primary_limit_angle = 0.785398
primary_damp_threshold = 0.0
secondary_limit_angle = 0.785398
secondary_damp_threshold = 0.0
[node name="StemIK2" type="LookAtModifier3D" parent="Armature/Skeleton3D" index="2"]
influence = 0.0
target_node = NodePath("../../../IKTarget")
bone_name = "Stem2"
bone = 1
forward_axis = 2
primary_rotation_axis = 0
duration = 0.2
transition_type = 1
use_angle_limitation = true
symmetry_limitation = true
primary_limit_angle = 0.785398
primary_damp_threshold = 0.0
secondary_limit_angle = 0.785398
secondary_damp_threshold = 0.0
[node name="StemIK3" type="LookAtModifier3D" parent="Armature/Skeleton3D" index="3"]
influence = 0.0
target_node = NodePath("../../../IKTarget")
bone_name = "Stem3"
bone = 2
forward_axis = 2
primary_rotation_axis = 0
duration = 0.2
transition_type = 1
use_angle_limitation = true
symmetry_limitation = true
primary_limit_angle = 0.785398
primary_damp_threshold = 0.0
secondary_limit_angle = 0.785398
secondary_damp_threshold = 0.0
[node name="StemIK4" type="LookAtModifier3D" parent="Armature/Skeleton3D" index="4"]
influence = 0.0
target_node = NodePath("../../../IKTarget")
bone_name = "Stem4"
bone = 3
forward_axis = 2
primary_rotation_axis = 0
duration = 0.2
transition_type = 1
use_angle_limitation = true
symmetry_limitation = true
primary_limit_angle = 0.785398
primary_damp_threshold = 0.0
secondary_limit_angle = 0.785398
secondary_damp_threshold = 0.0
[node name="StemIK5" type="LookAtModifier3D" parent="Armature/Skeleton3D" index="5"]
influence = 0.0
target_node = NodePath("../../../IKTarget")
bone_name = "Stem5"
bone = 4
forward_axis = 2
primary_rotation_axis = 0
duration = 0.2
transition_type = 1
use_angle_limitation = true
symmetry_limitation = true
primary_limit_angle = 1.0472
primary_damp_threshold = 0.0
secondary_limit_angle = 1.0472
secondary_damp_threshold = 0.0
[node name="IKTarget" type="Marker3D" parent="." index="2"]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
[node name="IKAnimation" type="AnimationPlayer" parent="." index="3"]
unique_name_in_owner = true
libraries = {
&"": SubResource("AnimationLibrary_xijsm")
}
[node name="TargetTarget" type="Marker3D" parent="." index="4"]
unique_name_in_owner = true

View File

@ -4,7 +4,7 @@
[ext_resource type="Resource" uid="uid://tgac5tnfx56r" path="res://src/world/world_manager.tres" id="2_5kmgb"] [ext_resource type="Resource" uid="uid://tgac5tnfx56r" path="res://src/world/world_manager.tres" id="2_5kmgb"]
[ext_resource type="PackedScene" uid="uid://byvjsvavbg5xe" path="res://src/ui/menus/pause_menu/pause_menu.tscn" id="2_6fy3g"] [ext_resource type="PackedScene" uid="uid://byvjsvavbg5xe" path="res://src/ui/menus/pause_menu/pause_menu.tscn" id="2_6fy3g"]
[ext_resource type="Resource" uid="uid://0i72bf8ip1lx" path="res://src/world/spook_manager.tres" id="3_l0av5"] [ext_resource type="Resource" uid="uid://0i72bf8ip1lx" path="res://src/world/spook_manager.tres" id="3_l0av5"]
[ext_resource type="PackedScene" uid="uid://bov4ok76woyc" path="res://levels/ghost_ship/ghost_ship.tscn" id="4_5kmgb"] [ext_resource type="PackedScene" uid="uid://b8rv6dg4tgaeb" path="res://levels/mechanic_test/mechanic_test.tscn" id="4_5kmgb"]
[ext_resource type="PackedScene" uid="uid://c0uitm5cg88h1" path="res://src/ui/menus/kill_screen/kill_screen.tscn" id="6_l0av5"] [ext_resource type="PackedScene" uid="uid://c0uitm5cg88h1" path="res://src/ui/menus/kill_screen/kill_screen.tscn" id="6_l0av5"]
[ext_resource type="PackedScene" uid="uid://brknr57xc2cp0" path="res://src/ui/elements/save_icon/save_icon.tscn" id="7_5kmgb"] [ext_resource type="PackedScene" uid="uid://brknr57xc2cp0" path="res://src/ui/elements/save_icon/save_icon.tscn" id="7_5kmgb"]