Compare commits

..

No commits in common. "3b0b3bbaf440836ff10095e0aa86d6a9451ee023" and "b5a2309e6b2ed7bf4f0db8455a00341d16ceb050" have entirely different histories.

2 changed files with 5 additions and 23 deletions

View File

@ -1135,7 +1135,7 @@ func _on_sprint_state_tick(delta: float) -> void:
soft_force_change_state(&'jump') soft_force_change_state(&'jump')
elif top_speed_proximity < 0.375: elif top_speed_proximity < 0.375:
state = &'run' state = &'run'
elif _get_effective_impetus().dot(linear_velocity) <= -0.96875: elif _get_effective_impetus().dot(linear_velocity) <= -0.75:
state = &'skid' state = &'skid'
func _on_jump_state_start() -> void: func _on_jump_state_start() -> void:

View File

@ -82,12 +82,10 @@ func _respond_to_impetus(delta: float) -> void:
) )
look_impetus = Vector3.ZERO look_impetus = Vector3.ZERO
func _find_closest_safe_spot( func _try_go(where: Vector3, from: Vector3 = global_position) -> void:
where: Vector3, from: Vector3 = global_position
) -> Vector3:
_raycast_object.from = from _raycast_object.from = from
_raycast_object.to = where + ( _raycast_object.to = where + (
(where - from).normalized()*clip_margin (where - global_position).normalized()*clip_margin
) )
if target: if target:
_raycast_object.exclude = [target] _raycast_object.exclude = [target]
@ -105,26 +103,10 @@ func _find_closest_safe_spot(
) )
if target && !allow_losing_target: if target && !allow_losing_target:
allow_losing_target = true allow_losing_target = true
var posn_a := _find_closest_safe_spot( _try_go(desired_position, target.global_position)
desired_position, target.global_position
)
if target is Character && target.is_node_ready():
var posn_b := _find_closest_safe_spot(
desired_position,
target.global_position + target.height*target.global_basis.y
)
if (
(posn_b - desired_position).length() <
(posn_a - desired_position).length()
):
posn_a = posn_b
allow_losing_target = false allow_losing_target = false
return posn_a
else: else:
return desired_position global_position = desired_position
func _try_go(where: Vector3) -> void:
global_position = _find_closest_safe_spot(where)
func snap_to_target() -> void: func snap_to_target() -> void:
if !target: return if !target: return