Refine player movement and world atmosphere
This commit is contained in:
parent
8f5f6c2603
commit
50e181249c
3 changed files with 45 additions and 31 deletions
|
|
@ -45,13 +45,13 @@ class ShowcaseCameraSnapshot:
|
||||||
|
|
||||||
|
|
||||||
@export_category("Movement")
|
@export_category("Movement")
|
||||||
@export var walk_speed: float = 5.0
|
@export var walk_speed: float = 4.5
|
||||||
@export var sprint_speed: float = 8.0
|
@export var sprint_speed: float = 7.2
|
||||||
@export var sneak_speed: float = 2.0
|
@export var sneak_speed: float = 1.8
|
||||||
@export var slow_walk_speed: float = 3.25
|
@export var slow_walk_speed: float = 2.9
|
||||||
@export_range(0.1, 20.0, 0.1) var jump_velocity: float = 4.6
|
@export_range(0.1, 20.0, 0.1) var jump_velocity: float = 4.6
|
||||||
@export_range(0.1, 5.0, 0.05) var upward_gravity_multiplier: float = 1.35
|
@export_range(0.1, 5.0, 0.05) var upward_gravity_multiplier: float = 1.35
|
||||||
@export_range(0.1, 5.0, 0.05) var fall_gravity_multiplier: float = 2.1
|
@export_range(0.1, 5.0, 0.05) var fall_gravity_multiplier: float = 2.35
|
||||||
@export_range(0.1, 3.0, 0.05) var body_center_height: float = 0.9
|
@export_range(0.1, 3.0, 0.05) var body_center_height: float = 0.9
|
||||||
@export var body_rotation_speed: float = 12.0
|
@export var body_rotation_speed: float = 12.0
|
||||||
|
|
||||||
|
|
@ -154,11 +154,23 @@ func _physics_process(delta: float) -> void:
|
||||||
if _network_interpolation_enabled:
|
if _network_interpolation_enabled:
|
||||||
_update_network_interpolation(delta)
|
_update_network_interpolation(delta)
|
||||||
return
|
return
|
||||||
|
var jump_requested: bool = (
|
||||||
|
_movement_enabled
|
||||||
|
and (
|
||||||
|
(local_control_enabled and Input.is_action_just_pressed("jump"))
|
||||||
|
or (_network_authoritative_simulation and _network_jump_pending)
|
||||||
|
)
|
||||||
|
)
|
||||||
if _sitting:
|
if _sitting:
|
||||||
velocity = Vector3.ZERO
|
if jump_requested:
|
||||||
return
|
_set_sitting(false)
|
||||||
|
else:
|
||||||
|
velocity = Vector3.ZERO
|
||||||
|
_network_jump_pending = false
|
||||||
|
return
|
||||||
if _water_recovery_active:
|
if _water_recovery_active:
|
||||||
velocity = Vector3.ZERO
|
velocity = Vector3.ZERO
|
||||||
|
_network_jump_pending = false
|
||||||
return
|
return
|
||||||
|
|
||||||
if not is_on_floor():
|
if not is_on_floor():
|
||||||
|
|
@ -168,16 +180,7 @@ func _physics_process(delta: float) -> void:
|
||||||
else fall_gravity_multiplier
|
else fall_gravity_multiplier
|
||||||
)
|
)
|
||||||
velocity.y -= _gravity * gravity_multiplier * delta
|
velocity.y -= _gravity * gravity_multiplier * delta
|
||||||
elif _movement_enabled and (
|
elif jump_requested:
|
||||||
(
|
|
||||||
local_control_enabled
|
|
||||||
and Input.is_action_just_pressed("jump")
|
|
||||||
)
|
|
||||||
or (
|
|
||||||
_network_authoritative_simulation
|
|
||||||
and _network_jump_pending
|
|
||||||
)
|
|
||||||
):
|
|
||||||
velocity.y = jump_velocity
|
velocity.y = jump_velocity
|
||||||
_network_jump_pending = false
|
_network_jump_pending = false
|
||||||
|
|
||||||
|
|
@ -295,14 +298,22 @@ func _update_character_animation() -> void:
|
||||||
|
|
||||||
|
|
||||||
func toggle_sitting() -> void:
|
func toggle_sitting() -> void:
|
||||||
if (
|
var should_sit: bool = not _sitting
|
||||||
_character_animation_player == null
|
if should_sit:
|
||||||
or not _character_animation_player.has_animation(
|
if (
|
||||||
CHARACTER_SITTING_ANIMATION
|
_character_animation_player == null
|
||||||
)
|
or not _character_animation_player.has_animation(
|
||||||
):
|
CHARACTER_SITTING_ANIMATION
|
||||||
|
)
|
||||||
|
):
|
||||||
|
return
|
||||||
|
_set_sitting(should_sit)
|
||||||
|
|
||||||
|
|
||||||
|
func _set_sitting(should_sit: bool) -> void:
|
||||||
|
if _sitting == should_sit:
|
||||||
return
|
return
|
||||||
_sitting = not _sitting
|
_sitting = should_sit
|
||||||
if _sitting:
|
if _sitting:
|
||||||
velocity = Vector3.ZERO
|
velocity = Vector3.ZERO
|
||||||
_character_animation_name = &""
|
_character_animation_name = &""
|
||||||
|
|
|
||||||
|
|
@ -8,15 +8,18 @@ sky = ExtResource("1_sky")
|
||||||
background_energy_multiplier = 0.85
|
background_energy_multiplier = 0.85
|
||||||
ambient_light_source = 3
|
ambient_light_source = 3
|
||||||
ambient_light_sky_contribution = 1.0
|
ambient_light_sky_contribution = 1.0
|
||||||
ambient_light_energy = 0.9
|
ambient_light_energy = 0.96
|
||||||
reflected_light_source = 2
|
reflected_light_source = 2
|
||||||
fog_enabled = true
|
fog_enabled = true
|
||||||
|
fog_mode = 1
|
||||||
fog_light_color = Color(0.54902, 0.74902, 0.764706, 1)
|
fog_light_color = Color(0.54902, 0.74902, 0.764706, 1)
|
||||||
fog_light_energy = 0.75
|
fog_light_energy = 0.82
|
||||||
fog_density = 0.0025
|
fog_aerial_perspective = 0.35
|
||||||
fog_aerial_perspective = 0.2
|
fog_sky_affect = 0.35
|
||||||
fog_sky_affect = 0.15
|
fog_depth_curve = 1.6
|
||||||
|
fog_depth_begin = 42.0
|
||||||
|
fog_depth_end = 170.0
|
||||||
adjustment_enabled = true
|
adjustment_enabled = true
|
||||||
adjustment_brightness = 0.9
|
adjustment_brightness = 0.95
|
||||||
adjustment_contrast = 0.89
|
adjustment_contrast = 0.89
|
||||||
adjustment_saturation = 0.91
|
adjustment_saturation = 0.91
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ environment = ExtResource("4_environment")
|
||||||
[node name="Sun" type="DirectionalLight3D" parent="Environment"]
|
[node name="Sun" type="DirectionalLight3D" parent="Environment"]
|
||||||
rotation_degrees = Vector3(-54, -32, 0)
|
rotation_degrees = Vector3(-54, -32, 0)
|
||||||
light_color = Color(1, 0.945098, 0.721569, 1)
|
light_color = Color(1, 0.945098, 0.721569, 1)
|
||||||
light_energy = 0.58
|
light_energy = 0.62
|
||||||
shadow_enabled = false
|
shadow_enabled = false
|
||||||
shadow_opacity = 0.58
|
shadow_opacity = 0.58
|
||||||
shadow_blur = 2.0
|
shadow_blur = 2.0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue