GDQuest / godot-steering-ai-framework

A complete framework for Godot to create beautiful and complex AI motion. Works both in 2D and in 3D.
http://gdquest.com/docs/godot-steering-ai-framework
MIT License
1.15k stars 78 forks source link

stop agents from processing when they are outside of the scene tree #55

Closed Jantho1990 closed 3 years ago

Jantho1990 commented 3 years ago

Please check if the PR fulfills these requirements:

Related issue (if applicable): #54

What kind of change does this PR introduce? Fixes https://github.com/GDQuest/godot-steering-ai-framework/issues/54

Does this PR introduce a breaking change? No.

New feature or change

What is the current behavior? GSAI Kinematic/Rigid agents continue processing when they are outside of the scene tree.

What is the new behavior? GSAI Kinematic/Rigid agents cease processing if they are outside of the scene tree.

Other information

NathanLovato commented 3 years ago

Thanks!

@Razoric480 may I let you check if the changes are the best way to go about that? Wouldn't there be a way to toggle off the callbacks on a parent class for instance?

Razoric480 commented 3 years ago

_apply_steering() is called by the user, it's not a callback. Since the body property changes for each agent type, in the child class is the place to check for its existence. So I think this is good.