diff --git a/assets/materials/dark_metal.material b/assets/materials/dark_metal.material new file mode 100644 index 0000000..85b2496 Binary files /dev/null and b/assets/materials/dark_metal.material differ diff --git a/assets/materials/metal.material b/assets/materials/metal.material new file mode 100644 index 0000000..0444a3d Binary files /dev/null and b/assets/materials/metal.material differ diff --git a/assets/materials/old_plastic.material b/assets/materials/old_plastic.material new file mode 100644 index 0000000..9edcd1e Binary files /dev/null and b/assets/materials/old_plastic.material differ diff --git a/assets/materials/orange_glow.material b/assets/materials/orange_glow.material new file mode 100644 index 0000000..4ec4d29 Binary files /dev/null and b/assets/materials/orange_glow.material differ diff --git a/assets/materials/wood.material b/assets/materials/wood.material new file mode 100644 index 0000000..51c24f3 Binary files /dev/null and b/assets/materials/wood.material differ diff --git a/assets/textures/circle.png b/assets/textures/circle.png new file mode 100644 index 0000000..ce64e43 Binary files /dev/null and b/assets/textures/circle.png differ diff --git a/assets/textures/circle.png.import b/assets/textures/circle.png.import new file mode 100644 index 0000000..085eab3 --- /dev/null +++ b/assets/textures/circle.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b4en3dw3q324p" +path.s3tc="res://.godot/imported/circle.png-cfb642d06c602215a6b6cc6699d3b82d.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://assets/textures/circle.png" +dest_files=["res://.godot/imported/circle.png-cfb642d06c602215a6b6cc6699d3b82d.s3tc.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/resources/environment.tres b/resources/environment.tres index 1cc30c1..7007f4b 100644 --- a/resources/environment.tres +++ b/resources/environment.tres @@ -1,10 +1,11 @@ [gd_resource type="Environment" format=3 uid="uid://drn5fwa4uhv4m"] [resource] -background_mode = 1 +background_mode = 2 background_color = Color(1, 1, 1, 1) ambient_light_source = 2 ambient_light_color = Color(0.678431, 0.501961, 0, 1) ambient_light_energy = 1.5 tonemap_mode = 1 -ssil_enabled = true +ssao_enabled = true +glow_enabled = true diff --git a/scenes/gravity_gun.tscn b/scenes/gravity_gun.tscn new file mode 100644 index 0000000..ba31c35 --- /dev/null +++ b/scenes/gravity_gun.tscn @@ -0,0 +1,117 @@ +[gd_scene load_steps=15 format=3 uid="uid://cl6gw3huejnrl"] + +[ext_resource type="ArrayMesh" uid="uid://cxw30fmp15jsd" path="res://models/gun.obj" id="1_803cf"] +[ext_resource type="Environment" uid="uid://drn5fwa4uhv4m" path="res://resources/environment.tres" id="1_vtn44"] +[ext_resource type="Material" uid="uid://b6r8e4302xg1d" path="res://assets/materials/dark_metal.material" id="2_qrl87"] +[ext_resource type="Shader" path="res://shaders/pbr_glass.gdshader" id="3_aeppb"] +[ext_resource type="Material" uid="uid://djwaye0a3cmds" path="res://assets/materials/wood.material" id="4_expk1"] +[ext_resource type="Material" uid="uid://wi5k6axixuwr" path="res://assets/materials/metal.material" id="5_algr0"] +[ext_resource type="Material" uid="uid://dy6hjdu4t4wan" path="res://assets/materials/orange_glow.material" id="6_ocwsh"] +[ext_resource type="Material" uid="uid://c8bic1or51fbf" path="res://assets/materials/old_plastic.material" id="7_c1s4a"] +[ext_resource type="Texture2D" uid="uid://b4en3dw3q324p" path="res://assets/textures/circle.png" id="8_al3c7"] + +[sub_resource type="World3D" id="World3D_6qira"] +environment = ExtResource("1_vtn44") + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_twwch"] +render_priority = 0 +shader = ExtResource("3_aeppb") +shader_parameter/albedo = Color(1, 1, 1, 0.0156863) +shader_parameter/roughness = 0.301 +shader_parameter/normal_strength = 16.0 +shader_parameter/edge_color = Color(1, 1, 1, 1) + +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_yttr4"] +lifetime_randomness = 0.1 +emission_shape = 1 +emission_sphere_radius = 0.2 +initial_velocity_min = 1.0 +initial_velocity_max = 1.0 +gravity = Vector3(3, -7.5, 0) +scale_min = 0.01 +scale_max = 0.07 +collision_mode = 2 +collision_use_scale = true + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_y24ld"] +transparency = 2 +alpha_scissor_threshold = 0.9 +alpha_antialiasing_mode = 0 +albedo_texture = ExtResource("8_al3c7") +emission_enabled = true +emission = Color(0.784314, 0.396078, 0, 1) +emission_energy_multiplier = 16.0 +billboard_mode = 1 +billboard_keep_scale = true + +[sub_resource type="QuadMesh" id="QuadMesh_wtlns"] +material = SubResource("StandardMaterial3D_y24ld") + +[node name="GravityGun" type="CanvasLayer"] +follow_viewport_enabled = true + +[node name="SubViewportContainer" type="SubViewportContainer" parent="."] +anchors_preset = 12 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_top = -324.0 +grow_horizontal = 2 +grow_vertical = 0 +stretch_shrink = 2 +metadata/_edit_use_anchors_ = true + +[node name="SubViewport" type="SubViewport" parent="SubViewportContainer"] +world_3d = SubResource("World3D_6qira") +transparent_bg = true +handle_input_locally = false +gui_embed_subwindows = true +size = Vector2i(1152, 648) +render_target_update_mode = 4 + +[node name="Node3D" type="Node3D" parent="SubViewportContainer/SubViewport"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -8, 0) + +[node name="MeshInstance3D" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/Node3D"] +transform = Transform3D(0.00445237, 0.182181, 0.983255, 0.0240231, 0.982961, -0.182236, -0.999701, 0.0244322, -4.29794e-08, 0.895815, -0.569743, -1.63173) +mesh = ExtResource("1_803cf") +surface_material_override/0 = ExtResource("2_qrl87") +surface_material_override/1 = SubResource("ShaderMaterial_twwch") +surface_material_override/2 = ExtResource("4_expk1") +surface_material_override/3 = ExtResource("5_algr0") +surface_material_override/4 = ExtResource("6_ocwsh") +surface_material_override/5 = ExtResource("7_c1s4a") + +[node name="GPUParticles3D" type="GPUParticles3D" parent="SubViewportContainer/SubViewport/Node3D/MeshInstance3D"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.20308, -0.000130415, 0.165362) +emitting = false +lifetime = 5.0 +randomness = 0.2 +visibility_aabb = AABB(-0.894568, -0.448322, -0.513538, 1.77742, 0.896643, 1.02708) +process_material = SubResource("ParticleProcessMaterial_yttr4") +draw_pass_1 = SubResource("QuadMesh_wtlns") + +[node name="GPUParticles3D2" type="GPUParticles3D" parent="SubViewportContainer/SubViewport/Node3D/MeshInstance3D"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.173204, 0.0331628, -0.182098) +lifetime = 5.0 +randomness = 0.5 +visibility_aabb = AABB(-0.894568, -0.448322, -0.513538, 1.77742, 0.896643, 1.02708) +process_material = SubResource("ParticleProcessMaterial_yttr4") +draw_pass_1 = SubResource("QuadMesh_wtlns") + +[node name="GPUParticles3D3" type="GPUParticles3D" parent="SubViewportContainer/SubViewport/Node3D/MeshInstance3D"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.132698, 0.304665, 0.0594321) +lifetime = 5.0 +randomness = 0.5 +visibility_aabb = AABB(-0.894568, -0.448322, -0.513538, 1.77742, 0.896643, 1.02708) +process_material = SubResource("ParticleProcessMaterial_yttr4") +draw_pass_1 = SubResource("QuadMesh_wtlns") + +[node name="GPUParticlesCollisionBox3D" type="GPUParticlesCollisionBox3D" parent="SubViewportContainer/SubViewport/Node3D/MeshInstance3D"] +transform = Transform3D(0.999923, -0.012392, 0.000616441, 0.0123854, 0.999875, 0.00980631, -0.000737865, -0.00979792, 0.999952, 0.358337, 0.108517, -0.0012207) +size = Vector3(1.17664, 0.301201, 0.299805) + +[node name="Camera3D" type="Camera3D" parent="SubViewportContainer/SubViewport/Node3D"] + +[node name="DirectionalLight3D" type="DirectionalLight3D" parent="SubViewportContainer/SubViewport/Node3D"] +transform = Transform3D(0.991671, 0, -0.128796, 0, 1, 0, 0.128796, 0, 0.991671, 0, 0, 0) diff --git a/scenes/levels/debug.tscn b/scenes/levels/debug.tscn index 62ebbce..f79ef16 100644 --- a/scenes/levels/debug.tscn +++ b/scenes/levels/debug.tscn @@ -1,11 +1,9 @@ -[gd_scene load_steps=15 format=3 uid="uid://ckad8stc13n83"] +[gd_scene load_steps=7 format=3 uid="uid://ckad8stc13n83"] [ext_resource type="PackedScene" uid="uid://gg5ph541e4p3" path="res://scenes/player.tscn" id="1_2585i"] [ext_resource type="PackedScene" uid="uid://ddwkhfly2xyyt" path="res://models/interior.obj" id="1_lphcl"] [ext_resource type="PackedScene" uid="uid://b8bvidqu7tmfs" path="res://scenes/objects/interactables/task_terminal.tscn" id="3_30m3x"] [ext_resource type="PackedScene" uid="uid://dqy8bqf1chm8c" path="res://scenes/objects/interactables/button_stand.tscn" id="4_cruoa"] -[ext_resource type="ArrayMesh" uid="uid://cxw30fmp15jsd" path="res://models/gun.obj" id="5_62nbh"] -[ext_resource type="Shader" path="res://shaders/pbr_glass.gdshader" id="6_vb4lq"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_780x3"] albedo_color = Color(0.133333, 0.133333, 0.133333, 1) @@ -14,41 +12,6 @@ metallic_specular = 0.0 [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_cra61"] albedo_color = Color(0.356863, 0.168627, 0, 1) -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_13ant"] -cull_mode = 2 -albedo_color = Color(0.05359, 0.05359, 0.05359, 1) -roughness = 0.42 -clearcoat_enabled = true -clearcoat_roughness = 1.0 - -[sub_resource type="ShaderMaterial" id="ShaderMaterial_twwch"] -render_priority = 0 -shader = ExtResource("6_vb4lq") -shader_parameter/albedo = Color(1, 1, 1, 0.0156863) -shader_parameter/roughness = 0.301 -shader_parameter/normal_strength = 16.0 -shader_parameter/edge_color = Color(1, 1, 1, 1) - -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_lednd"] -cull_mode = 2 -albedo_color = Color(0.08984, 0.019501, 0, 1) - -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_vq0we"] -albedo_color = Color(0.282353, 0.282353, 0.282353, 1) -metallic = 1.0 -clearcoat_enabled = true - -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_n0xde"] -albedo_color = Color(1, 0.490196, 0, 1) -rim_enabled = true -rim_tint = 1.0 -backlight_enabled = true -backlight = Color(1, 0.490196, 0, 1) - -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_e1ogg"] -cull_mode = 2 -albedo_color = Color(0.495402, 0.401949, 0.222077, 1) - [node name="Debug" type="Node3D"] [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] @@ -75,14 +38,4 @@ transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0.5, 0 [node name="ButtonStand" parent="." instance=ExtResource("4_cruoa")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0.7, 0) -[node name="MeshInstance3D" type="MeshInstance3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.56923, 0) -mesh = ExtResource("5_62nbh") -surface_material_override/0 = SubResource("StandardMaterial3D_13ant") -surface_material_override/1 = SubResource("ShaderMaterial_twwch") -surface_material_override/2 = SubResource("StandardMaterial3D_lednd") -surface_material_override/3 = SubResource("StandardMaterial3D_vq0we") -surface_material_override/4 = SubResource("StandardMaterial3D_n0xde") -surface_material_override/5 = SubResource("StandardMaterial3D_e1ogg") - [editable path="interior"] diff --git a/scenes/player.tscn b/scenes/player.tscn index 81b2ff6..c175359 100644 --- a/scenes/player.tscn +++ b/scenes/player.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=3 format=3 uid="uid://gg5ph541e4p3"] +[gd_scene load_steps=4 format=3 uid="uid://gg5ph541e4p3"] [ext_resource type="Script" path="res://scripts/player.gd" id="1_8d33x"] +[ext_resource type="PackedScene" uid="uid://cl6gw3huejnrl" path="res://scenes/gravity_gun.tscn" id="2_ahuce"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_2qx4s"] height = 1.9 @@ -14,3 +15,7 @@ shape = SubResource("CapsuleShape3D_2qx4s") [node name="Camera3D" type="Camera3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.8, 0) current = true + +[node name="GravityGun" parent="." instance=ExtResource("2_ahuce")] + +[editable path="GravityGun"] diff --git a/scripts/player.gd b/scripts/player.gd index 8c7ebe4..fbe20a3 100644 --- a/scripts/player.gd +++ b/scripts/player.gd @@ -8,13 +8,17 @@ const JUMP_VELOCITY = 4.5 var gravity: float = ProjectSettings.get_setting("physics/3d/default_gravity") @onready var camera: Camera3D = $Camera3D +@onready var gun_cam: Camera3D = $GravityGun/SubViewportContainer/SubViewport/Node3D/Camera3D var camera_senitivity: float = 0.5 func _ready() -> void: capture() + camera.make_current() func _physics_process(delta: float) -> void: + gun_cam.transform = camera.transform + if not is_on_floor(): velocity.y -= gravity * delta @@ -36,7 +40,7 @@ func _input(event: InputEvent) -> void: if event is InputEventMouseMotion && Input.mouse_mode == Input.MOUSE_MODE_CAPTURED: rotate_y(-event.relative.x * camera_senitivity * 0.0025) camera.rotate_x(-event.relative.y * camera_senitivity * 0.0015) - camera.rotation_degrees.x = clamp(camera.rotation_degrees.x, -60, 80) + camera.rotation_degrees.x = clamp(camera.rotation_degrees.x, -30, 80) if event.is_action_pressed("pause"): capture(false) if event.is_action_pressed("mouse_capture"):