mirror of
https://github.com/Relintai/godot-steering-ai-framework.git
synced 2024-11-14 04:57:19 +01:00
Stop agents from processing when they are outside of the scene tree (#55)
This commit is contained in:
parent
53cad0f660
commit
22dc7c751a
@ -50,6 +50,9 @@ func _apply_sliding_steering(accel: Vector3, delta: float) -> void:
|
||||
if not _body:
|
||||
return
|
||||
|
||||
if not _body.is_inside_tree():
|
||||
return
|
||||
|
||||
var velocity := GSAIUtils.to_vector2(linear_velocity + accel * delta).clamped(linear_speed_max)
|
||||
if apply_linear_drag:
|
||||
velocity = velocity.linear_interpolate(Vector2.ZERO, linear_drag_percentage)
|
||||
|
@ -132,6 +132,9 @@ func _on_SceneTree_physics_frame() -> void:
|
||||
if not _body:
|
||||
return
|
||||
|
||||
if not _body.is_inside_tree():
|
||||
return
|
||||
|
||||
var current_position := _body.transform.origin
|
||||
var current_orientation := _body.rotation.y
|
||||
|
||||
|
@ -51,6 +51,9 @@ func _on_SceneTree_frame() -> void:
|
||||
if not _body:
|
||||
return
|
||||
|
||||
if not _body.is_inside_tree():
|
||||
return
|
||||
|
||||
var current_position := _body.global_position
|
||||
var current_orientation := _body.rotation
|
||||
|
||||
|
@ -50,6 +50,9 @@ func _on_SceneTree_frame() -> void:
|
||||
if not _body:
|
||||
return
|
||||
|
||||
if not _body.is_inside_tree():
|
||||
return
|
||||
|
||||
var current_position := _body.transform.origin
|
||||
var current_orientation := _body.rotation.y
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user