Improved environment

This commit is contained in:
2024-01-16 23:01:16 +01:00
parent 8f0f3d9998
commit 6934f2936b
16 changed files with 274 additions and 96 deletions

20
world/Camera.gd Normal file
View File

@ -0,0 +1,20 @@
extends Camera3D
@export var center: Node3D
@export var follow_speed: float
@export var shake_strength: float
var noise = FastNoiseLite.new()
func _ready():
Global.camera = self
func _process(delta):
center.position = lerp(center.position, Global.player.position, follow_speed * delta)
# func shake(time):
# var trauma_sq := 1.0
# var h_offset := noise.get_noise_2d(time, 0) * trauma_sq * shake_strength
# var v_offset := noise.get_noise_2d(time, 1) * trauma_sq * shake_strength
# rotate_x(noise.get_noise_2d(time, 2) * trauma_sq * shake_strength)
# rotate_y(noise.get_noise_2d(time, 3) * trauma_sq * shake_strength)
# rotate_z(noise.get_noise_2d(time, 4) * trauma_sq * shake_strength)

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=20 format=3 uid="uid://b40y7iuskv1ar"]
[gd_scene load_steps=26 format=3 uid="uid://b40y7iuskv1ar"]
[ext_resource type="Script" path="res://world/Game.gd" id="1_xmqq4"]
[ext_resource type="Script" path="res://world/RotateY.gd" id="3_4gn6n"]
@ -7,33 +7,14 @@
[ext_resource type="Script" path="res://network/Network.gd" id="4_ao4cj"]
[ext_resource type="Shader" path="res://world/shader/Outline.gdshader" id="4_gweie"]
[ext_resource type="Script" path="res://network/Ping.gd" id="4_vx388"]
[ext_resource type="PackedScene" uid="uid://2lcnu3dy54lx" path="res://player/Player.tscn" id="5_6c2x8"]
[ext_resource type="Environment" uid="uid://dixa0yso2s1u3" path="res://world/Environment.tres" id="5_bll74"]
[ext_resource type="Script" path="res://world/Sun.gd" id="5_pf5uw"]
[ext_resource type="CameraAttributesPractical" uid="uid://b835orxyqq6w5" path="res://world/CameraAttributes.tres" id="6_8wfwf"]
[ext_resource type="Script" path="res://network/Login.gd" id="6_augbg"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_r8n03"]
diffuse_mode = 3
albedo_color = Color(0.482353, 0.470588, 0.47451, 1)
[sub_resource type="BoxMesh" id="BoxMesh_0bujj"]
material = SubResource("StandardMaterial3D_r8n03")
size = Vector3(20, 0.5, 20)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_4w7ln"]
diffuse_mode = 3
albedo_color = Color(0.294118, 0.356863, 0.439216, 1)
[sub_resource type="BoxMesh" id="BoxMesh_hf021"]
material = SubResource("StandardMaterial3D_4w7ln")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ahmjh"]
diffuse_mode = 3
albedo_color = Color(0.14902, 0.517647, 1, 1)
roughness = 0.08
[sub_resource type="TorusMesh" id="TorusMesh_mu45b"]
material = SubResource("StandardMaterial3D_ahmjh")
[ext_resource type="Script" path="res://ui/PositionLabel.gd" id="8_jc5xy"]
[ext_resource type="Script" path="res://world/Camera.gd" id="9_qfhy4"]
[ext_resource type="PackedScene" uid="uid://hnn0n1xc2qt7" path="res://world/Tree.blend" id="15_csh38"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_qm56v"]
render_priority = 0
@ -50,26 +31,55 @@ material = SubResource("ShaderMaterial_qm56v")
flip_faces = true
size = Vector2(2, 2)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_r8n03"]
diffuse_mode = 3
albedo_color = Color(0.482353, 0.470588, 0.47451, 1)
[sub_resource type="BoxMesh" id="BoxMesh_0bujj"]
material = SubResource("StandardMaterial3D_r8n03")
size = Vector3(20, 0.5, 20)
[sub_resource type="BoxShape3D" id="BoxShape3D_58ws3"]
size = Vector3(20, 0.5, 20)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_4w7ln"]
diffuse_mode = 3
albedo_color = Color(0.294118, 0.356863, 0.439216, 1)
[sub_resource type="BoxMesh" id="BoxMesh_hf021"]
material = SubResource("StandardMaterial3D_4w7ln")
[sub_resource type="BoxShape3D" id="BoxShape3D_3lxo8"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ahmjh"]
diffuse_mode = 3
albedo_color = Color(0.14902, 0.517647, 1, 1)
roughness = 0.08
[sub_resource type="TorusMesh" id="TorusMesh_mu45b"]
material = SubResource("StandardMaterial3D_ahmjh")
[node name="Game" type="Node"]
script = ExtResource("1_xmqq4")
[node name="World" type="Node3D" parent="."]
[node name="Network" type="Node" parent="."]
unique_name_in_owner = true
script = ExtResource("4_ao4cj")
[node name="Ground" type="MeshInstance3D" parent="World"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.25, 0)
mesh = SubResource("BoxMesh_0bujj")
skeleton = NodePath("../..")
[node name="Ping" type="Node" parent="Network"]
unique_name_in_owner = true
script = ExtResource("4_vx388")
[node name="Box" type="MeshInstance3D" parent="World"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, -4)
mesh = SubResource("BoxMesh_hf021")
skeleton = NodePath("../../SubViewportContainer/SubViewport")
[node name="Timer" type="Timer" parent="Network/Ping"]
autostart = true
[node name="Torus" type="MeshInstance3D" parent="World"]
transform = Transform3D(0.7, 0, 0, 0, -3.0598e-08, -0.7, 0, 0.7, -3.0598e-08, 0, 1.79933, -4)
mesh = SubResource("TorusMesh_mu45b")
skeleton = NodePath("../../SubViewportContainer/SubViewport")
script = ExtResource("3_4gn6n")
[node name="Login" type="Node" parent="Network"]
script = ExtResource("6_augbg")
playerScene = ExtResource("5_6c2x8")
[node name="Timer" type="Timer" parent="Network/Login"]
wait_time = 10.0
autostart = true
[node name="UI" type="Control" parent="."]
layout_mode = 3
@ -108,16 +118,17 @@ layout_mode = 2
text = "0"
script = ExtResource("4_1a3hc")
[node name="Network" type="Node" parent="."]
unique_name_in_owner = true
script = ExtResource("4_ao4cj")
[node name="HBoxContainer3" type="HBoxContainer" parent="UI/CanvasLayer/MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="Ping" type="Node" parent="Network"]
unique_name_in_owner = true
script = ExtResource("4_vx388")
[node name="PositionLabel" type="Label" parent="UI/CanvasLayer/MarginContainer/VBoxContainer/HBoxContainer3"]
layout_mode = 2
text = "Position:"
[node name="Login" type="Node" parent="Network"]
script = ExtResource("6_augbg")
[node name="Position" type="Label" parent="UI/CanvasLayer/MarginContainer/VBoxContainer/HBoxContainer3"]
layout_mode = 2
text = "0"
script = ExtResource("8_jc5xy")
[node name="SubViewportContainer" type="SubViewportContainer" parent="."]
texture_filter = 1
@ -134,15 +145,20 @@ handle_input_locally = false
size = Vector2i(384, 216)
render_target_update_mode = 4
[node name="Camera" type="Camera3D" parent="SubViewportContainer/SubViewport"]
transform = Transform3D(0.707107, 0.331966, -0.624338, 0, 0.882947, 0.469472, 0.707107, -0.331966, 0.624338, -5, 5, 5)
[node name="CameraCenter" type="Node3D" parent="SubViewportContainer/SubViewport"]
[node name="Camera" type="Camera3D" parent="SubViewportContainer/SubViewport/CameraCenter" node_paths=PackedStringArray("center")]
transform = Transform3D(0.707107, 0.408607, -0.577096, 0, 0.816138, 0.577858, 0.707107, -0.408607, 0.577096, -10, 10, 10)
projection = 1
current = true
fov = 90.0
size = 9.6
near = 0.001
size = 10.0
far = 100.0
script = ExtResource("9_qfhy4")
center = NodePath("..")
follow_speed = 5.0
[node name="PostProcessing" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/Camera"]
[node name="PostProcessing" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/CameraCenter/Camera"]
unique_name_in_owner = true
extra_cull_margin = 16384.0
mesh = SubResource("QuadMesh_7yiqd")
@ -156,3 +172,40 @@ script = ExtResource("5_pf5uw")
[node name="Environment" type="WorldEnvironment" parent="SubViewportContainer/SubViewport"]
environment = ExtResource("5_bll74")
camera_attributes = ExtResource("6_8wfwf")
[node name="World" type="Node3D" parent="SubViewportContainer/SubViewport"]
[node name="Ground" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.25, 0)
mesh = SubResource("BoxMesh_0bujj")
skeleton = NodePath("../../../..")
[node name="StaticBody3D" type="StaticBody3D" parent="SubViewportContainer/SubViewport/World/Ground"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="SubViewportContainer/SubViewport/World/Ground/StaticBody3D"]
shape = SubResource("BoxShape3D_58ws3")
[node name="Box" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, -4)
mesh = SubResource("BoxMesh_hf021")
skeleton = NodePath("../..")
[node name="RigidBody3D" type="RigidBody3D" parent="SubViewportContainer/SubViewport/World/Box"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="SubViewportContainer/SubViewport/World/Box/RigidBody3D"]
shape = SubResource("BoxShape3D_3lxo8")
[node name="Torus" type="MeshInstance3D" parent="SubViewportContainer/SubViewport/World"]
transform = Transform3D(0.7, 0, 0, 0, -3.0598e-08, -0.7, 0, 0.7, -3.0598e-08, 0, 1.79933, -4)
mesh = SubResource("TorusMesh_mu45b")
skeleton = NodePath("../..")
script = ExtResource("3_4gn6n")
[node name="Tree" parent="SubViewportContainer/SubViewport/World" instance=ExtResource("15_csh38")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.11323, 0, -4.64839)
[node name="Players" type="Node3D" parent="SubViewportContainer/SubViewport"]
unique_name_in_owner = true
[connection signal="timeout" from="Network/Ping/Timer" to="Network/Ping" method="send_ping"]
[connection signal="timeout" from="Network/Login/Timer" to="Network/Login" method="send_login"]

4
world/Global.gd Normal file
View File

@ -0,0 +1,4 @@
extends Node
var camera: Camera3D
var player: Player

50
world/Tree.blend.import Normal file
View File

@ -0,0 +1,50 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://hnn0n1xc2qt7"
path="res://.godot/imported/Tree.blend-8edaf7c4bb18f0f1f1c8fa5b8380d9ea.scn"
[deps]
source_file="res://world/Tree.blend"
dest_files=["res://.godot/imported/Tree.blend-8edaf7c4bb18f0f1f1c8fa5b8380d9ea.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
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
import_script/path=""
_subresources={}
gltf/naming_version=1
gltf/embedded_image_handling=1
blender/nodes/visible=0
blender/nodes/punctual_lights=true
blender/nodes/cameras=true
blender/nodes/custom_properties=true
blender/nodes/modifiers=1
blender/meshes/colors=false
blender/meshes/uvs=true
blender/meshes/normals=true
blender/meshes/tangents=true
blender/meshes/skins=2
blender/meshes/export_bones_deforming_mesh_only=false
blender/materials/unpack_enabled=true
blender/materials/export_materials=1
blender/animation/limit_playback=true
blender/animation/always_sample=true
blender/animation/group_tracks=true