diff --git a/models/Body_T_Face.png b/models/Body_T_Face.png index d4454a9..f86b26b 100644 Binary files a/models/Body_T_Face.png and b/models/Body_T_Face.png differ diff --git a/models/Hammer.glb b/models/Hammer.glb new file mode 100644 index 0000000..cb6e9a0 Binary files /dev/null and b/models/Hammer.glb differ diff --git a/models/Hammer.glb.import b/models/Hammer.glb.import new file mode 100644 index 0000000..4a377d1 --- /dev/null +++ b/models/Hammer.glb.import @@ -0,0 +1,42 @@ +[remap] + +importer="scene" +importer_version=1 +type="PackedScene" +uid="uid://c4cpduyayg7m" +path="res://.godot/imported/Hammer.glb-56c5f617d7ebd1afee9d21db3ca71ad2.scn" + +[deps] + +source_file="res://models/Hammer.glb" +dest_files=["res://.godot/imported/Hammer.glb-56c5f617d7ebd1afee9d21db3ca71ad2.scn"] + +[params] + +nodes/root_type="" +nodes/root_name="" +nodes/root_script=null +nodes/apply_root_scale=true +nodes/root_scale=0.009999999999999998 +nodes/import_as_skeleton_bones=false +nodes/use_name_suffixes=true +nodes/use_node_type_suffixes=true +meshes/ensure_tangents=true +meshes/generate_lods=true +meshes/create_shadow_meshes=true +meshes/light_baking=1 +meshes/lightmap_texel_size=0.2 +meshes/force_disable_compression=false +skins/use_named_skins=true +animation/import=true +animation/fps=30 +animation/trimming=false +animation/remove_immutable_tracks=true +animation/import_rest_as_RESET=false +import_script/path="" +materials/extract=0 +materials/extract_format=0 +materials/extract_path="" +_subresources={} +gltf/naming_version=2 +gltf/embedded_image_handling=1 diff --git a/models/Hammer_T_Hammer.png b/models/Hammer_T_Hammer.png new file mode 100644 index 0000000..911e397 Binary files /dev/null and b/models/Hammer_T_Hammer.png differ diff --git a/models/Hammer_T_Hammer.png.import b/models/Hammer_T_Hammer.png.import new file mode 100644 index 0000000..da4dff4 --- /dev/null +++ b/models/Hammer_T_Hammer.png.import @@ -0,0 +1,44 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://5rjxc4yetqx2" +path.s3tc="res://.godot/imported/Hammer_T_Hammer.png-3e85039454e8f001d18736fd1fee7638.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} +generator_parameters={ +"md5": "6244feb1775a88dcea51d7b35f8ab233" +} + +[deps] + +source_file="res://models/Hammer_T_Hammer.png" +dest_files=["res://.godot/imported/Hammer_T_Hammer.png-3e85039454e8f001d18736fd1fee7638.s3tc.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/models/hammer_vis.gd b/models/hammer_vis.gd new file mode 100644 index 0000000..13ac7ed --- /dev/null +++ b/models/hammer_vis.gd @@ -0,0 +1,16 @@ +extends Node3D +@onready var hammer_in_viewport: Node3D = $"../Character/Head/Hammer In Viewport" +@onready var hammer_shelf_vis: Node3D = $Hammer + +var isHammerInViewport:bool = false + +func _input(event: InputEvent) -> void: + if event.is_action_pressed("hammer_toggle"): + isHammerInViewport = !isHammerInViewport + if isHammerInViewport: + hammer_in_viewport.visible = true + hammer_shelf_vis.visible = false + else: + hammer_in_viewport.visible = false + hammer_shelf_vis.visible = true + diff --git a/models/hammer_vis.gd.uid b/models/hammer_vis.gd.uid new file mode 100644 index 0000000..27329f5 --- /dev/null +++ b/models/hammer_vis.gd.uid @@ -0,0 +1 @@ +uid://dcym4t8d3muis diff --git a/project.godot b/project.godot index e29cc60..5768ae4 100644 --- a/project.godot +++ b/project.godot @@ -109,6 +109,16 @@ blend={ "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":66,"key_label":0,"unicode":98,"location":0,"echo":false,"script":null) ] } +hammer_toggle={ +"deadzone": 0.2, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":67,"key_label":0,"unicode":99,"location":0,"echo":false,"script":null) +] +} +hammering={ +"deadzone": 0.2, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":90,"key_label":0,"unicode":121,"location":0,"echo":false,"script":null) +] +} [physics] diff --git a/scenes/hammering.gd b/scenes/hammering.gd new file mode 100644 index 0000000..e1f8017 --- /dev/null +++ b/scenes/hammering.gd @@ -0,0 +1,26 @@ +extends Node3D + + +@onready var body_animaiton: AnimationPlayer = $"../../../CoffinSwitcher/CoffinOpenable/AnimatedBody/AnimationPlayer" +@onready var hammer_animation: AnimationPlayer = $AnimationPlayer +@onready var face: MeshInstance3D = $"../../../CoffinSwitcher/CoffinOpenable/AnimatedBody/Armature/Skeleton3D/BoneAttachment3D/Body_002" + +var uv_base:Vector3 = Vector3(0.,.25,0.) +var uv_after_hit: Vector3 = Vector3(.5,0.,0.) + +func _input(event: InputEvent) -> void: + if event.is_action_pressed("hammering"): + var tween = get_tree().create_tween() + + hammer_animation.play("swing") + + tween.tween_interval(0.3) + tween.tween_callback(body_animaiton.play.bind("Face Hit")) + tween.tween_callback(setuv.bind(uv_after_hit)) + + if event.is_action_pressed("ui_left"): + setuv(uv_base) + +func setuv(value:Vector3): + var faceMat:BaseMaterial3D = face.get_active_material(0) + faceMat.uv1_offset = value diff --git a/scenes/hammering.gd.uid b/scenes/hammering.gd.uid new file mode 100644 index 0000000..4bd9ef2 --- /dev/null +++ b/scenes/hammering.gd.uid @@ -0,0 +1 @@ +uid://gy52d2t3moyx diff --git a/scenes/room.tscn b/scenes/room.tscn index eef0dba..fab3ac5 100644 --- a/scenes/room.tscn +++ b/scenes/room.tscn @@ -1,11 +1,9 @@ -[gd_scene load_steps=91 format=4 uid="uid://157h04x0krfu"] +[gd_scene load_steps=92 format=4 uid="uid://157h04x0krfu"] [ext_resource type="PackedScene" uid="uid://bjufextny1icg" path="res://models/UndertakerAssets.glb" id="1_7dqbv"] [ext_resource type="ArrayMesh" uid="uid://c5hhygnuya8m4" path="res://models/ceiling.res" id="1_jn645"] [ext_resource type="PackedScene" uid="uid://vqn2vnm5uonx" path="res://models/AnimatedBody.glb" id="1_wg1up"] -[ext_resource type="Texture2D" uid="uid://cmctogmnkjjsx" path="res://models/AnimatedBody_T_Face.png" id="2_ns543"] [ext_resource type="ArrayMesh" uid="uid://clarjq81uknpt" path="res://models/door.res" id="2_qvc4m"] -[ext_resource type="Script" uid="uid://btddh0r45yuh4" path="res://scenes/just_blend.gd" id="2_wkj6l"] [ext_resource type="ArrayMesh" uid="uid://bvdlv1xumxsvr" path="res://models/duct.res" id="3_7dqbv"] [ext_resource type="PackedScene" uid="uid://be7u1kn41g2ww" path="res://addons/interaction/interactable.tscn" id="3_w68ji"] [ext_resource type="ArrayMesh" uid="uid://nvm86aghye8t" path="res://models/floor.res" id="4_ybpoa"] @@ -24,6 +22,7 @@ [ext_resource type="PackedScene" uid="uid://bwf1m3q64007x" path="res://prefabs/lamp_ceiling.tscn" id="16_vfrn5"] [ext_resource type="ArrayMesh" uid="uid://cemnmemdquy7" path="res://models/lamp_wall.res" id="17_vfrn5"] [ext_resource type="ArrayMesh" uid="uid://bbdtm4w2gihid" path="res://models/liftarms.res" id="19_2ulci"] +[ext_resource type="Script" uid="uid://gy52d2t3moyx" path="res://scenes/hammering.gd" id="19_jr8j8"] [ext_resource type="VoxelGIData" uid="uid://rfxeiyxkedo6" path="res://scenes/room.VoxelGI_data.res" id="19_jxwrd"] [ext_resource type="ArrayMesh" uid="uid://d0uaw7ewx52pp" path="res://models/coffin_lower.res" id="19_yggoe"] [ext_resource type="ArrayMesh" uid="uid://bel68d6prmovl" path="res://models/coffin_upper.res" id="20_2ulci"] @@ -33,6 +32,7 @@ [ext_resource type="ArrayMesh" uid="uid://buy1tqwpmqsb4" path="res://models/button.res" id="25_2ftkj"] [ext_resource type="Script" uid="uid://b22xrvio2577x" path="res://scenes/coffin_slide_fire.gd" id="27_ny2il"] [ext_resource type="ArrayMesh" uid="uid://vtl7yxfd4hhq" path="res://models/main_screen.res" id="28_gjarb"] +[ext_resource type="Texture2D" uid="uid://dvgdewx5cksgk" path="res://models/Body_T_Face.png" id="28_rhbk5"] [ext_resource type="Script" uid="uid://bysnkaditp712" path="res://scenes/main_screen.gd" id="29_1wmww"] [ext_resource type="Texture2D" uid="uid://bqkfnastii3yn" path="res://screens/contract-1.png" id="29_5o3hq"] [ext_resource type="Texture2D" uid="uid://7s837i2pg2t4" path="res://screens/contract-2_NEW_2.png" id="30_1wmww"] @@ -50,6 +50,8 @@ [ext_resource type="PackedScene" uid="uid://dcvhqqp75xtws" path="res://prefabs/rose.tscn" id="48_1s4n5"] [ext_resource type="Script" uid="uid://bgrc6ktuxyrm6" path="res://scenes/pickupable.gd" id="49_bahpm"] [ext_resource type="PackedScene" uid="uid://cddhjs1rtgotq" path="res://models/RubberDuck.glb" id="50_11at7"] +[ext_resource type="PackedScene" uid="uid://c4cpduyayg7m" path="res://models/Hammer.glb" id="51_gmm1g"] +[ext_resource type="Script" uid="uid://dcym4t8d3muis" path="res://models/hammer_vis.gd" id="52_rhbk5"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_frp7b"] albedo_color = Color(0, 0, 0, 1) @@ -65,6 +67,66 @@ height = 0.01 [sub_resource type="BoxShape3D" id="BoxShape3D_vfrn5"] size = Vector3(50, 1, 50) +[sub_resource type="Animation" id="Animation_d3vt8"] +resource_name = "swing" +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Hammer:position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.13333334, 0.27106056, 0.36666667, 0.56666666, 1), +"transitions": PackedFloat32Array(1.5691682, 1, 1.4142137, 0.24148425, 1, 1.8025008), +"update": 0, +"values": [Vector3(0.4108131, -0.26517308, -0.27325583), Vector3(0.39777717, 0.057593107, -0.25365797), Vector3(0.39777717, 0.057593107, -0.25365797), Vector3(0.13994613, -0.04627271, -0.7106246), Vector3(0.14, 0.049, -0.646), Vector3(0.4108131, -0.26517308, -0.27325583)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Hammer:rotation") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 0.13333334, 0.27106056, 0.36666667, 0.56666666, 1), +"transitions": PackedFloat32Array(1.5691682, 1, 1.4142137, 0.24148425, 1, 1.8025008), +"update": 0, +"values": [Vector3(0.11430395, -1.5166974, 0.7919705), Vector3(0.1143039, -1.5166973, 0.18115765), Vector3(0.1143039, -1.5166973, 0.18115765), Vector3(0.1607498, -1.3422315, 1.0099306), Vector3(0.1607498, -1.3422315, 1.0099306), Vector3(0.11430395, -1.5166974, 0.7919705)] +} + +[sub_resource type="Animation" id="Animation_jr8j8"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Hammer:position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector3(0.4108131, -0.26517308, -0.27325583)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Hammer:rotation") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector3(0.11430395, -1.5166974, 0.7919705)] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_lxjld"] +_data = { +&"RESET": SubResource("Animation_jr8j8"), +&"swing": SubResource("Animation_d3vt8") +} + [sub_resource type="Animation" id="Animation_2ftkj"] resource_name = "CoffinClose" length = 1.304 @@ -158,7 +220,7 @@ _data = { [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_2b7e3"] resource_name = "M_Face" cull_mode = 2 -albedo_texture = ExtResource("2_ns543") +albedo_texture = ExtResource("28_rhbk5") roughness = 0.5 uv1_offset = Vector3(0.75, 0.25, 0) texture_filter = 2 @@ -195,24 +257,6 @@ _surfaces = [{ blend_shape_mode = 0 shadow_mesh = SubResource("ArrayMesh_mwhaa") -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ns543"] -animation = &"ArmatureAction" - -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_g8dr5"] -animation = &"ArmatureAction" - -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_xtec0"] - -[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_xcuph"] -graph_offset = Vector2(-492, 145) -nodes/Animation/node = SubResource("AnimationNodeAnimation_g8dr5") -nodes/Animation/position = Vector2(-200, 120) -nodes/Blend2/node = SubResource("AnimationNodeBlend2_xtec0") -nodes/Blend2/position = Vector2(100, 160) -"nodes/Animation 2/node" = SubResource("AnimationNodeAnimation_ns543") -"nodes/Animation 2/position" = Vector2(-220, 320) -node_connections = [&"output", 0, &"Blend2", &"Blend2", 0, &"Animation", &"Blend2", 1, &"Animation 2"] - [sub_resource type="BoxShape3D" id="BoxShape3D_bahpm"] size = Vector3(0.41427612, 0.09663391, 0.3550415) @@ -668,6 +712,21 @@ transform = Transform3D(-1.0392305, 0, -0.5999999, 0, 1.1999999, 0, 0.5999999, 0 [node name="Camera" parent="Character/Head" index="0"] current = true +[node name="InteractionRay" parent="Character/Head" index="3"] +visible = false + +[node name="Hammer In Viewport" type="Node3D" parent="Character/Head" index="5"] +transform = Transform3D(0.35, 0, 0, 0, 0.35, 0, 0, 0, 0.35, 0, 0, 0) +script = ExtResource("19_jr8j8") + +[node name="Hammer" parent="Character/Head/Hammer In Viewport" instance=ExtResource("51_gmm1g")] +transform = Transform3D(-0.08615163, -0.23697144, -1.9840418, 1.4141886, 1.3957207, -0.22811039, 1.411612, -1.4127308, 0.107439354, 0.4108131, -0.26517308, -0.27325583) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="Character/Head/Hammer In Viewport"] +libraries = { +&"": SubResource("AnimationLibrary_lxjld") +} + [node name="Lever" parent="." instance=ExtResource("6_dynfe")] transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -1.9271023, 1.3349965, 2.5290997) @@ -732,12 +791,6 @@ skeleton = NodePath("") [node name="Body_001" parent="CoffinSwitcher/CoffinOpenable/AnimatedBody" index="1"] visible = false -[node name="AnimationTree" type="AnimationTree" parent="CoffinSwitcher/CoffinOpenable/AnimatedBody"] -tree_root = SubResource("AnimationNodeBlendTree_xcuph") -anim_player = NodePath("../AnimationPlayer") -parameters/Blend2/blend_amount = 0.0 -script = ExtResource("2_wkj6l") - [node name="StaticBody3D" type="StaticBody3D" parent="CoffinSwitcher/CoffinOpenable"] [node name="CollisionShape3D" type="CollisionShape3D" parent="CoffinSwitcher/CoffinOpenable/StaticBody3D"] @@ -1228,6 +1281,12 @@ transform = Transform3D(-0.007914604, -0.00079391425, -0.018350165, -0.000733232 transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6.1297956, 1.00343, 2.6191468) mesh = SubResource("BoxMesh_gmm1g") +[node name="Hammer_on_shelf" type="Node3D" parent="."] +script = ExtResource("52_rhbk5") + +[node name="Hammer" parent="Hammer_on_shelf" instance=ExtResource("51_gmm1g")] +transform = Transform3D(0.5660891, -1.9103099, 0.1739514, 0, 0.18136814, 1.9917594, -1.9182135, -0.56375664, 0.051335264, -0.75209147, 1.0442615, -2.8823638) + [connection signal="changed" from="Lever" to="CoffinSwitcher/CoffinOpenable" method="_on_lever_changed"] [connection signal="on_hit" from="Button/Interactable" to="CoffinSwitcher/CoffinSlideFire" method="_on_interactable_on_hit"] [connection signal="on_hit" from="Button2/Interactable" to="CoffinSwitcher/CoffinSlideFire" method="_on_interactable_on_hit"]