diff --git a/3d/voxel/icon.webp.import b/3d/voxel/icon.webp.import index cc29159c..6d517c78 100644 --- a/3d/voxel/icon.webp.import +++ b/3d/voxel/icon.webp.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ct compress/mode=0 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 @@ -25,6 +27,10 @@ mipmaps/generate=false 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 diff --git a/3d/voxel/menu/button.png.import b/3d/voxel/menu/button.png.import index 66180026..4fac3f1a 100644 --- a/3d/voxel/menu/button.png.import +++ b/3d/voxel/menu/button.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/button.png-e6ddd405c0968c9fb68dca7b600a69a3.c compress/mode=0 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 @@ -25,6 +27,10 @@ mipmaps/generate=false 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 diff --git a/3d/voxel/menu/button_focus.png.import b/3d/voxel/menu/button_focus.png.import index 7edfc7e0..ee230962 100644 --- a/3d/voxel/menu/button_focus.png.import +++ b/3d/voxel/menu/button_focus.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/button_focus.png-ab1bb8cac03c67d70abe367eb75a compress/mode=0 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 @@ -25,6 +27,10 @@ mipmaps/generate=false 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 diff --git a/3d/voxel/menu/button_hover.png.import b/3d/voxel/menu/button_hover.png.import index decdefbf..75a5d80e 100644 --- a/3d/voxel/menu/button_hover.png.import +++ b/3d/voxel/menu/button_hover.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/button_hover.png-cc3a5a29d50cd231bbad40ad5523 compress/mode=0 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 @@ -25,6 +27,10 @@ mipmaps/generate=false 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 diff --git a/3d/voxel/menu/button_pressed.png.import b/3d/voxel/menu/button_pressed.png.import index dc293c82..d4a4904b 100644 --- a/3d/voxel/menu/button_pressed.png.import +++ b/3d/voxel/menu/button_pressed.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/button_pressed.png-1a7de8cb7b9d369c3113c6cd6f compress/mode=0 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 @@ -25,6 +27,10 @@ mipmaps/generate=false 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 diff --git a/3d/voxel/menu/main/dark_dirt.png.import b/3d/voxel/menu/main/dark_dirt.png.import index 1b3122f1..f3d66c5f 100644 --- a/3d/voxel/menu/main/dark_dirt.png.import +++ b/3d/voxel/menu/main/dark_dirt.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/dark_dirt.png-8e8d84e3c30520a8995166be2b7ea97 compress/mode=0 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 @@ -25,6 +27,10 @@ mipmaps/generate=false 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 diff --git a/3d/voxel/menu/main/title.png.import b/3d/voxel/menu/main/title.png.import index 058a8694..197993fa 100644 --- a/3d/voxel/menu/main/title.png.import +++ b/3d/voxel/menu/main/title.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/title.png-73a3b55f70af530edac2d45668ba262c.ct compress/mode=0 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 @@ -25,6 +27,10 @@ mipmaps/generate=false 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=false process/premult_alpha=false process/normal_map_invert_y=false diff --git a/3d/voxel/menu/theme/TinyUnicode.ttf.import b/3d/voxel/menu/theme/TinyUnicode.ttf.import index 4d7c0506..a609f8ca 100644 --- a/3d/voxel/menu/theme/TinyUnicode.ttf.import +++ b/3d/voxel/menu/theme/TinyUnicode.ttf.import @@ -21,6 +21,7 @@ msdf_pixel_range=8 msdf_size=48 allow_system_fallback=true force_autohinter=false +modulate_color_glyphs=false hinting=1 subpixel_positioning=1 keep_rounding_remainders=true diff --git a/3d/voxel/player/crosshair.svg.import b/3d/voxel/player/crosshair.svg.import index 528e3504..32516ffc 100644 --- a/3d/voxel/player/crosshair.svg.import +++ b/3d/voxel/player/crosshair.svg.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/crosshair.svg-c15896115a8fc4f09948d0fd31ee95e compress/mode=0 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 @@ -25,6 +27,10 @@ mipmaps/generate=false 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 diff --git a/3d/voxel/player/player.gd b/3d/voxel/player/player.gd index 63ba963c..6be1de62 100644 --- a/3d/voxel/player/player.gd +++ b/3d/voxel/player/player.gd @@ -6,22 +6,23 @@ const EYE_HEIGHT_CROUCH = 1.4 const MOVEMENT_SPEED_GROUND = 70.0 const MOVEMENT_SPEED_AIR = 13.0 const MOVEMENT_SPEED_CROUCH_MODIFIER = 0.5 +const MOVEMENT_SPEED_SPRINT_MODIFIER = 1.375 const MOVEMENT_FRICTION_GROUND = 12.5 const MOVEMENT_FRICTION_AIR = 2.25 -const MOVEMENT_JUMP_VELOCITY = 7.25 +const MOVEMENT_JUMP_VELOCITY = 9.0 var _mouse_motion := Vector2() var _selected_block := 6 -@onready var gravity := float(ProjectSettings.get_setting("physics/3d/default_gravity")) - @onready var head: Node3D = $Head +@onready var camera: Camera3D = $Head/Camera3D @onready var raycast: RayCast3D = $Head/RayCast3D @onready var camera_attributes: CameraAttributes = $Head/Camera3D.attributes @onready var selected_block_texture: TextureRect = $SelectedBlock @onready var voxel_world: Node = $"../VoxelWorld" @onready var crosshair: CenterContainer = $"../PauseMenu/Crosshair" @onready var aim_preview: MeshInstance3D = $AimPreview +@onready var neutral_fov: float = camera.fov func _ready() -> void: @@ -81,12 +82,13 @@ func _physics_process(delta: float) -> void: camera_attributes.dof_blur_far_distance = Settings.fog_distance * 1.5 camera_attributes.dof_blur_far_transition = Settings.fog_distance * 0.125 # Crouching. - var crouching := Input.is_action_pressed(&"crouch") + var crouching: bool = Input.is_action_pressed(&"crouch") + var sprinting: bool = Input.is_action_pressed(&"move_sprint") head.transform.origin.y = lerpf(head.transform.origin.y, EYE_HEIGHT_CROUCH if crouching else EYE_HEIGHT_STAND, 1.0 - exp(-delta * 16.0)) # Keyboard movement. - var movement_vec2 := Input.get_vector("move_left", "move_right", "move_forward", "move_back") - var movement := transform.basis * (Vector3(movement_vec2.x, 0, movement_vec2.y)) + var movement_vec2: Vector2 = Input.get_vector("move_left", "move_right", "move_forward", "move_back") + var movement: Vector3 = transform.basis * (Vector3(movement_vec2.x, 0, movement_vec2.y)) if is_on_floor(): movement *= MOVEMENT_SPEED_GROUND @@ -95,10 +97,17 @@ func _physics_process(delta: float) -> void: if crouching: movement *= MOVEMENT_SPEED_CROUCH_MODIFIER + sprinting = false + var target_fov: float = neutral_fov + if sprinting: + movement *= MOVEMENT_SPEED_SPRINT_MODIFIER + target_fov = neutral_fov * 1.25 + camera.fov = lerpf(camera.fov, target_fov, 1.0 - exp(-delta * 10.0)) # Gravity. if not is_on_floor(): - velocity.y -= gravity * delta + var factor: float = 3.0 - clampf(velocity.y / -MOVEMENT_JUMP_VELOCITY, 0.0, 2.0) + velocity += get_gravity() * (delta * factor) velocity += Vector3(movement.x, 0, movement.z) * delta # Apply horizontal friction. diff --git a/3d/voxel/player/player.tscn b/3d/voxel/player/player.tscn index c2820726..297a59e9 100644 --- a/3d/voxel/player/player.tscn +++ b/3d/voxel/player/player.tscn @@ -47,9 +47,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.6, 0) [node name="Camera3D" type="Camera3D" parent="Head"] attributes = SubResource("CameraAttributesPractical_jyixh") -fov = 74.0 -near = 0.02 -far = 1000.0 [node name="RayCast3D" type="RayCast3D" parent="Head"] target_position = Vector3(0, 0, -5) diff --git a/3d/voxel/project.godot b/3d/voxel/project.godot index ad59b0a0..7e2afb37 100644 --- a/3d/voxel/project.godot +++ b/3d/voxel/project.godot @@ -18,7 +18,7 @@ quite limiting. If you are making your own voxel game, you should probably use Zylann's voxel module instead: https://github.com/Zylann/godot_voxel" config/tags=PackedStringArray("3d", "demo", "official") run/main_scene="res://menu/main/main_menu.tscn" -config/features=PackedStringArray("4.4") +config/features=PackedStringArray("4.5") config/icon="res://icon.webp" [autoload] @@ -67,6 +67,13 @@ move_right={ , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) ] } +move_sprint={ +"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":4194326,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +, 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":4194327,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":2,"pressure":0.0,"pressed":false,"script":null) +] +} jump={ "deadzone": 0.2, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) @@ -149,7 +156,6 @@ pick_block={ common/physics_ticks_per_second=120 3d/physics_engine="GodotPhysics3D" -3d/default_gravity=20.0 common/physics_interpolation=true [rendering] diff --git a/3d/voxel/world/textures/texture_sheet.png.import b/3d/voxel/world/textures/texture_sheet.png.import index a3998431..0b70e073 100644 --- a/3d/voxel/world/textures/texture_sheet.png.import +++ b/3d/voxel/world/textures/texture_sheet.png.import @@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/texture_sheet.png-52286655fc64f0acb01bdaefe1f compress/mode=0 compress/high_quality=false compress/lossy_quality=1.0 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 compress/hdr_compression=1 compress/normal_map=0 compress/channel_pack=0 @@ -25,6 +27,10 @@ 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=false process/premult_alpha=false process/normal_map_invert_y=false