mirror of
https://github.com/Relintai/godot-steering-ai-framework.git
synced 2024-11-10 00:52:10 +01:00
Stop agents from processing when they are outside of the scene tree (#55)
This commit is contained in:
parent
53cad0f660
commit
22dc7c751a
@ -49,6 +49,9 @@ func _apply_sliding_steering(accel: Vector3, delta: float) -> void:
|
||||
var _body: KinematicBody2D = _body_ref.get_ref()
|
||||
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:
|
||||
|
@ -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
|
||||
|
||||
|
@ -50,6 +50,9 @@ func _on_SceneTree_frame() -> void:
|
||||
var _body: RigidBody2D = _body_ref.get_ref()
|
||||
if not _body:
|
||||
return
|
||||
|
||||
if not _body.is_inside_tree():
|
||||
return
|
||||
|
||||
var current_position := _body.global_position
|
||||
var current_orientation := _body.rotation
|
||||
|
@ -49,6 +49,9 @@ func _on_SceneTree_frame() -> void:
|
||||
var _body: RigidBody = _body_ref.get_ref()
|
||||
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