diff --git a/addons/proton_scatter/cache/house_big_10774354_scatter_cache.res b/addons/proton_scatter/cache/house_big_10774354_scatter_cache.res index 875af07..406cd15 100644 Binary files a/addons/proton_scatter/cache/house_big_10774354_scatter_cache.res and b/addons/proton_scatter/cache/house_big_10774354_scatter_cache.res differ diff --git a/project.godot b/project.godot index 37cc13b..3061163 100644 --- a/project.godot +++ b/project.godot @@ -20,6 +20,10 @@ config/icon="res://icon.svg" window/size/viewport_width=1920 window/size/viewport_height=1080 +[editor] + +movie_writer/mjpeg_quality=0.9 + [editor_plugins] enabled=PackedStringArray("res://addons/portals/plugin.cfg", "res://addons/proton_scatter/plugin.cfg") diff --git a/scenes/house_big.tscn b/scenes/house_big.tscn index 677a78a..393e66f 100644 --- a/scenes/house_big.tscn +++ b/scenes/house_big.tscn @@ -60,7 +60,7 @@ albedo_color = Color(0.448364, 0.428649, 0.0977373, 1) [sub_resource type="BoxMesh" id="BoxMesh_kpybi"] size = Vector3(1000, 0.5, 1000) -[sub_resource type="Resource" id="Resource_nrbqc"] +[sub_resource type="Resource" id="Resource_u6m7x"] script = ExtResource("7_4hat2") amount = 1500 enabled = true @@ -69,7 +69,7 @@ custom_seed = 0 restrict_height = true reference_frame = 1 -[sub_resource type="Resource" id="Resource_1c0ay"] +[sub_resource type="Resource" id="Resource_nrbqc"] script = ExtResource("8_u6m7x") position = Vector3(0.15, 0.15, 0.15) rotation = Vector3(20, 360, 20) @@ -80,7 +80,7 @@ custom_seed = 0 restrict_height = false reference_frame = 2 -[sub_resource type="Resource" id="Resource_purgm"] +[sub_resource type="Resource" id="Resource_1c0ay"] script = ExtResource("9_nrbqc") iterations = 3 offset_step = 0.2 @@ -92,7 +92,7 @@ custom_seed = 0 restrict_height = true reference_frame = 0 -[sub_resource type="Resource" id="Resource_615iq"] +[sub_resource type="Resource" id="Resource_purgm"] script = ExtResource("10_1c0ay") ray_direction = Vector3(0, -1, 0) ray_length = 5.0 @@ -108,9 +108,9 @@ custom_seed = 0 restrict_height = false reference_frame = 0 -[sub_resource type="Resource" id="Resource_31h7w"] +[sub_resource type="Resource" id="Resource_615iq"] script = ExtResource("5_3bxb3") -stack = Array[ExtResource("6_53v87")]([SubResource("Resource_nrbqc"), SubResource("Resource_1c0ay"), SubResource("Resource_purgm"), SubResource("Resource_615iq")]) +stack = Array[ExtResource("6_53v87")]([SubResource("Resource_u6m7x"), SubResource("Resource_nrbqc"), SubResource("Resource_1c0ay"), SubResource("Resource_purgm")]) [sub_resource type="Resource" id="Resource_37qwj"] script = ExtResource("13_1c0ay") @@ -127,7 +127,7 @@ script = ExtResource("12_615iq") size = Vector3(15.4096, 1, 9.6442) metadata/_custom_type_script = "uid://d011g8ga6gea7" -[sub_resource type="Resource" id="Resource_ob3ci"] +[sub_resource type="Resource" id="Resource_31h7w"] script = ExtResource("7_4hat2") amount = 1200 enabled = true @@ -136,7 +136,7 @@ custom_seed = 0 restrict_height = true reference_frame = 1 -[sub_resource type="Resource" id="Resource_61s38"] +[sub_resource type="Resource" id="Resource_ob3ci"] script = ExtResource("8_u6m7x") position = Vector3(0.1, 0.15, 0.1) rotation = Vector3(10, 360, 10) @@ -147,7 +147,7 @@ custom_seed = 0 restrict_height = false reference_frame = 2 -[sub_resource type="Resource" id="Resource_p6hgd"] +[sub_resource type="Resource" id="Resource_61s38"] script = ExtResource("9_nrbqc") iterations = 3 offset_step = 0.2 @@ -159,7 +159,7 @@ custom_seed = 0 restrict_height = true reference_frame = 0 -[sub_resource type="Resource" id="Resource_o0mww"] +[sub_resource type="Resource" id="Resource_p6hgd"] script = ExtResource("10_1c0ay") ray_direction = Vector3(0, -1, 0) ray_length = 5.0 @@ -175,9 +175,9 @@ custom_seed = 0 restrict_height = false reference_frame = 0 -[sub_resource type="Resource" id="Resource_ckunl"] +[sub_resource type="Resource" id="Resource_o0mww"] script = ExtResource("5_3bxb3") -stack = Array[ExtResource("6_53v87")]([SubResource("Resource_ob3ci"), SubResource("Resource_61s38"), SubResource("Resource_p6hgd"), SubResource("Resource_o0mww")]) +stack = Array[ExtResource("6_53v87")]([SubResource("Resource_31h7w"), SubResource("Resource_ob3ci"), SubResource("Resource_61s38"), SubResource("Resource_p6hgd")]) [sub_resource type="Resource" id="Resource_f17e3"] script = ExtResource("12_615iq") @@ -209,7 +209,7 @@ metadata/_edit_lock_ = true [node name="ScatterGrass" type="Node3D" parent="Meadow"] script = ExtResource("4_u6m7x") force_rebuild_on_load = false -modifier_stack = SubResource("Resource_31h7w") +modifier_stack = SubResource("Resource_615iq") Performance/use_chunks = true Performance/chunk_dimensions = Vector3(15, 15, 15) metadata/_custom_type_script = "uid://mlpya7qid02x" @@ -252,7 +252,7 @@ metadata/_custom_type_script = "uid://bsl3en0gdt8ka" [node name="ScatterTrees" type="Node3D" parent="Meadow"] script = ExtResource("4_u6m7x") force_rebuild_on_load = false -modifier_stack = SubResource("Resource_ckunl") +modifier_stack = SubResource("Resource_o0mww") Performance/use_chunks = true Performance/chunk_dimensions = Vector3(15, 15, 15) metadata/_custom_type_script = "uid://mlpya7qid02x" diff --git a/scenes/world.tscn b/scenes/world.tscn index bd04baa..358edc4 100644 --- a/scenes/world.tscn +++ b/scenes/world.tscn @@ -84,7 +84,7 @@ radius = 0.2 height = 1.75 [node name="World" type="Node3D"] -metadata/movie_file = "captures/b_.png" +metadata/movie_file = "captures/e_.avi" [node name="WorldEnvironment" type="WorldEnvironment" parent="."] environment = SubResource("Environment_o8fc1") @@ -232,7 +232,7 @@ _teleport_area_path = NodePath("TeleportArea") _teleport_collider_path = NodePath("TeleportArea/Collider") portal_size = Vector2(1.5, 2.5) exit_portal = NodePath("../PortalSmall") -portal_frame_width = 0.0 +portal_frame_width = 1.0 viewport_size_mode = 0 view_direction = 1 portal_render_layer = 524288 @@ -264,7 +264,7 @@ shape = SubResource("BoxShape3D_7t5mc") shape = SubResource("WorldBoundaryShape3D_dss4m") [node name="CharacterBody3D" type="CharacterBody3D" parent="." node_paths=PackedStringArray("camera")] -transform = Transform3D(0.258819, 0, 0.965926, 0, 1, 0, -0.965926, 0, 0.258819, 12.9999, 1.36224, -1.22552) +transform = Transform3D(-0.524357, 0, 0.851498, 0, 1, 0, -0.851498, 0, -0.524357, 10.6968, 1.36224, -8.3989) collision_layer = 3 script = ExtResource("17_7t5mc") camera = NodePath("Camera3D") diff --git a/scripts/player.gd b/scripts/player.gd index 536ec9a..2fa9186 100644 --- a/scripts/player.gd +++ b/scripts/player.gd @@ -30,37 +30,51 @@ func _process(delta: float) -> void: rotation.y = lerp_angle(rotation.y, target_rotation.y, delta * ROTATION_SPEED) camera.rotation.x = lerp_angle(camera.rotation.x, target_rotation.x, delta * ROTATION_SPEED) - -func _physics_process(delta: float) -> void: - var right: Vector3 = (global_transform.basis.x * Vector3(1, 0, 1)).normalized() - var forward: Vector3 = (-global_transform.basis.z * Vector3(1, 0, 1)).normalized() - var has_input = false - velocity.x = 0 - velocity.z = 0 +const ACCELERATION := 10.0 +const DECELERATION := 6.0 + +var input_direction := Vector3.ZERO +var target_velocity := Vector3.ZERO + +func _get_input_direction() -> Vector3: + var direction := Vector3.ZERO if Input.is_key_pressed(KEY_LEFT) or Input.is_key_pressed(KEY_A): - has_input = true - velocity -= right + direction.x -= 1 if Input.is_key_pressed(KEY_RIGHT) or Input.is_key_pressed(KEY_D): - has_input = true - velocity += right + direction.x += 1 if Input.is_key_pressed(KEY_UP) or Input.is_key_pressed(KEY_W): - has_input = true - velocity += forward + direction.z += 1 if Input.is_key_pressed(KEY_DOWN) or Input.is_key_pressed(KEY_S): - has_input = true - velocity -= forward + direction.z -= 1 + return direction.normalized() + +func _physics_process(delta: float) -> void: + # Get input direction relative to player orientation + input_direction = _get_input_direction() - if has_input: - var normalized_horizontal_velocity = Vector2(velocity.x, velocity.z).normalized() - velocity.x = normalized_horizontal_velocity.x * SPEED - velocity.z = normalized_horizontal_velocity.y * SPEED + var basis := global_transform.basis + var forward := -basis.z.normalized() + var right := basis.x.normalized() + # Desired horizontal movement direction in world space + var desired_velocity : Vector3 = (right * input_direction.x + forward * input_direction.z) * SPEED + desired_velocity.y = 0 # Only horizontal + + # Smooth acceleration/deceleration + var accel := DECELERATION if input_direction == Vector3.ZERO else ACCELERATION + target_velocity.x = lerp(target_velocity.x, desired_velocity.x, accel * delta) + target_velocity.z = lerp(target_velocity.z, desired_velocity.z, accel * delta) + + # Preserve existing vertical velocity if not is_on_floor(): - velocity += get_gravity() * delta - - if Input.is_action_just_pressed("ui_accept") and is_on_floor(): - velocity.y = JUMP_VELOCITY + target_velocity.y += get_gravity().y * delta + else: + target_velocity.y = 0 + if Input.is_action_just_pressed("ui_accept"): + target_velocity.y = JUMP_VELOCITY + # Apply movement + velocity = target_velocity move_and_slide()