Fixed an issue that caused movement to become erratic at very low framerates.
This commit is contained in:
@@ -158,7 +158,7 @@ func _move_character():
|
|||||||
character.move_and_slide()
|
character.move_and_slide()
|
||||||
|
|
||||||
func _root_motion_walk_process(_delta:float) -> void:
|
func _root_motion_walk_process(_delta:float) -> void:
|
||||||
_current_movement_speed = lerpf(_current_movement_speed, _target_movement_vector.length_squared(), _delta * _walk_reaction_speed)
|
_current_movement_speed = lerpf(_current_movement_speed, _target_movement_vector.length_squared(), clampf(_delta * _walk_reaction_speed, 0.0, 1.0))
|
||||||
character.character_skeleton.animation_tree["parameters/walk/blend_position"] = _current_movement_speed
|
character.character_skeleton.animation_tree["parameters/walk/blend_position"] = _current_movement_speed
|
||||||
_root_motion_accumulation_process(_delta)
|
_root_motion_accumulation_process(_delta)
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ func _camera_relative_heading_process(_delta:float):
|
|||||||
var _camera_relative_rotation : Quaternion = \
|
var _camera_relative_rotation : Quaternion = \
|
||||||
Quaternion(Vector3(_target_movement_vector.x, 0.0, _target_movement_vector.y).normalized(), \
|
Quaternion(Vector3(_target_movement_vector.x, 0.0, _target_movement_vector.y).normalized(), \
|
||||||
Vector3(-player_camera.camera.global_basis.z.x, 0.0, -player_camera.camera.global_basis.z.z).normalized())
|
Vector3(-player_camera.camera.global_basis.z.x, 0.0, -player_camera.camera.global_basis.z.z).normalized())
|
||||||
character.quaternion = character.quaternion.slerp(_camera_relative_rotation, _delta * _walk_turn_speed)
|
character.quaternion = character.quaternion.slerp(_camera_relative_rotation, clampf(_delta * _walk_turn_speed, 0.0, 1.0))
|
||||||
|
|
||||||
func _lateral_movement_physics_process(_delta:float) -> void:
|
func _lateral_movement_physics_process(_delta:float) -> void:
|
||||||
character.velocity = _lateral_motion_accumulator / _delta
|
character.velocity = _lateral_motion_accumulator / _delta
|
||||||
|
|||||||
+1
-1
Submodule addons/liborng updated: 306db05bfc...6e508ccde2
Reference in New Issue
Block a user