diff --git a/bt/behavior_tree.cpp b/bt/behavior_tree.cpp index b607c19..c6a5cf3 100644 --- a/bt/behavior_tree.cpp +++ b/bt/behavior_tree.cpp @@ -118,7 +118,7 @@ void BehaviorTree::_bind_methods() { ClassDB::bind_method(D_METHOD("get_root_task"), &BehaviorTree::get_root_task); ClassDB::bind_method(D_METHOD("clone"), &BehaviorTree::clone); ClassDB::bind_method(D_METHOD("copy_other", "other"), &BehaviorTree::copy_other); - ClassDB::bind_method(D_METHOD("instantiate", "agent", "blackboard", "scene_root"), &BehaviorTree::instantiate); + ClassDB::bind_method(D_METHOD("instantiate", "agent", "blackboard", "instance_owner"), &BehaviorTree::instantiate); ADD_PROPERTY(PropertyInfo(Variant::STRING, "description", PROPERTY_HINT_MULTILINE_TEXT), "set_description", "get_description"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "blackboard_plan", PROPERTY_HINT_RESOURCE_TYPE, "BlackboardPlan", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT), "set_blackboard_plan", "get_blackboard_plan"); diff --git a/doc/source/classes/class_behaviortree.rst b/doc/source/classes/class_behaviortree.rst index daea317..5b7a89e 100644 --- a/doc/source/classes/class_behaviortree.rst +++ b/doc/source/classes/class_behaviortree.rst @@ -55,17 +55,17 @@ Methods .. table:: :widths: auto - +-----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`BehaviorTree` | :ref:`clone`\ (\ ) |const| | - +-----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | |void| | :ref:`copy_other`\ (\ other\: :ref:`BehaviorTree`\ ) | - +-----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`BTTask` | :ref:`get_root_task`\ (\ ) |const| | - +-----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`BTInstance` | :ref:`instantiate`\ (\ agent\: ``Node``, blackboard\: :ref:`Blackboard`, scene_root\: ``Node``\ ) |const| | - +-----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | |void| | :ref:`set_root_task`\ (\ task\: :ref:`BTTask`\ ) | - +-----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`BehaviorTree` | :ref:`clone`\ (\ ) |const| | + +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`copy_other`\ (\ other\: :ref:`BehaviorTree`\ ) | + +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`BTTask` | :ref:`get_root_task`\ (\ ) |const| | + +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`BTInstance` | :ref:`instantiate`\ (\ agent\: ``Node``, blackboard\: :ref:`Blackboard`, instance_owner\: ``Node``\ ) |const| | + +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`set_root_task`\ (\ task\: :ref:`BTTask`\ ) | + +-----------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator @@ -172,9 +172,13 @@ Returns the root task of the BehaviorTree resource. .. rst-class:: classref-method -:ref:`BTInstance` **instantiate**\ (\ agent\: ``Node``, blackboard\: :ref:`Blackboard`, scene_root\: ``Node``\ ) |const| :ref:`🔗` +:ref:`BTInstance` **instantiate**\ (\ agent\: ``Node``, blackboard\: :ref:`Blackboard`, instance_owner\: ``Node``\ ) |const| :ref:`🔗` -Instantiates the behavior tree and returns :ref:`BTInstance`. ``scene_root`` should be the root node of the scene that the Behavior Tree will be used in (e.g., the owner of the node that contains the behavior tree instance). +Instantiates the behavior tree and returns :ref:`BTInstance`. + +\ ``instance_owner`` should be the scene node that will own the behavior tree instance. + +This is typically a :ref:`BTPlayer`, :ref:`BTState`, or a custom player node that controls the behavior tree execution. .. rst-class:: classref-item-separator diff --git a/doc_classes/BehaviorTree.xml b/doc_classes/BehaviorTree.xml index 16b900f..57b65b5 100644 --- a/doc_classes/BehaviorTree.xml +++ b/doc_classes/BehaviorTree.xml @@ -38,9 +38,9 @@ - + - Instantiates the behavior tree and returns [BTInstance]. [param scene_root] should be the root node of the scene that the Behavior Tree will be used in (e.g., the owner of the node that contains the behavior tree instance). + Instantiates the behavior tree and returns [BTInstance]. [param instance_owner] should be the scene node that will own the behavior tree instance. This is typically a [BTPlayer], [BTState], or a custom player node that controls the behavior tree execution.