mirror of
https://github.com/Relintai/godot-steering-ai-framework.git
synced 2024-11-14 04:57:19 +01:00
Fix bug with implementation of drag in Arrive
Drag should inexorably draw towards 0, but when slow enough it could instead cause a reverse direction.
This commit is contained in:
parent
fa91e6bca7
commit
617b837772
@ -36,7 +36,7 @@ func _unhandled_input(event: InputEvent) -> void:
|
|||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
_accel = _arrive.calculate_steering(_accel)
|
_accel = _arrive.calculate_steering(_accel)
|
||||||
_velocity += Vector2(_accel.linear.x, _accel.linear.y)
|
_velocity += Vector2(_accel.linear.x, _accel.linear.y)
|
||||||
_velocity -= _velocity * _drag * delta
|
_velocity = _velocity.linear_interpolate(Vector2.ZERO, 0.1)
|
||||||
_velocity = move_and_slide(_velocity)
|
_velocity = move_and_slide(_velocity)
|
||||||
_update_agent()
|
_update_agent()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user