2022-11-01 20:31:22 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-11-15 14:40:07 +00:00
<class name= "BTPlayer" inherits= "Node" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../../../doc/class.xsd" >
2022-11-01 20:31:22 +00:00
<brief_description >
2022-11-04 12:27:09 +00:00
Player of [BehaviorTree] resources.
2022-11-01 20:31:22 +00:00
</brief_description>
<description >
2024-05-02 17:35:42 +00:00
[BTPlayer] node is used to instantiate and play [BehaviorTree] resources at runtime. During initialization, the behavior tree instance is given references to the agent, the [member blackboard], and the current scene root. The agent can be specified by the [member agent_node] property (defaults to the BTPlayer's parent node).
2023-10-26 11:44:09 +00:00
For an introduction to behavior trees, see [BehaviorTree].
2022-11-01 20:31:22 +00:00
</description>
<tutorials >
</tutorials>
<methods >
2024-08-03 11:14:31 +00:00
<method name= "get_bt_instance" >
<return type= "BTInstance" />
2023-04-10 14:57:36 +00:00
<description >
2024-08-03 11:14:31 +00:00
Returns the behavior tree instance.
2024-02-03 16:28:56 +00:00
</description>
</method>
2022-11-01 20:31:22 +00:00
<method name= "restart" >
<return type= "void" />
<description >
2023-10-26 11:44:09 +00:00
Resets the behavior tree's execution. Each running task will be aborted and the next tree execution will start anew. This method does not reset [Blackboard].
2022-11-01 20:31:22 +00:00
</description>
</method>
2024-08-04 10:36:44 +00:00
<method name= "set_bt_instance" >
<return type= "void" />
<param index= "0" name= "bt_instance" type= "BTInstance" />
<description >
2024-08-05 11:31:30 +00:00
Sets the [BTInstance] to play. This method is useful when you want to switch to a different behavior tree instance at runtime. See also [method BehaviorTree.instantiate].
2024-08-04 10:36:44 +00:00
</description>
</method>
2024-08-05 10:49:58 +00:00
<method name= "set_scene_root_hint" >
<return type= "void" />
<param index= "0" name= "scene_root" type= "Node" />
<description >
Sets the [Node] that will be used as the scene root for the newly instantiated behavior tree. Should be called before the [BTPlayer] is added to the scene tree (before [code]NOTIFICATION_READY[/code]). This is typically useful when creating [BTPlayer] nodes dynamically from code.
</description>
</method>
2022-11-01 20:31:22 +00:00
<method name= "update" >
<return type= "void" />
2024-03-04 20:36:16 +00:00
<param index= "0" name= "delta" type= "float" />
2022-11-01 20:31:22 +00:00
<description >
2023-10-26 11:44:09 +00:00
Executes the root task of the behavior tree instance if [member active] is [code]true[/code]. Call this method when [member update_mode] is set to [constant MANUAL]. When [member update_mode] is not [constant MANUAL], the [method update] will be called automatically. See [enum UpdateMode].
2022-11-01 20:31:22 +00:00
</description>
</method>
</methods>
<members >
2023-04-10 14:57:36 +00:00
<member name= "active" type= "bool" setter= "set_active" getter= "get_active" default= "true" >
2023-10-26 11:44:09 +00:00
If [code]true[/code], the behavior tree will be executed during update.
2022-11-01 20:31:22 +00:00
</member>
2024-05-02 11:39:19 +00:00
<member name= "agent_node" type= "NodePath" setter= "set_agent_node" getter= "get_agent_node" default= "NodePath("..")" >
Path to the node that will be used as the agent. Setting it after instantiation will have no effect.
</member>
2022-11-01 20:31:22 +00:00
<member name= "behavior_tree" type= "BehaviorTree" setter= "set_behavior_tree" getter= "get_behavior_tree" >
2023-10-26 11:44:09 +00:00
[BehaviorTree] resource to instantiate and execute at runtime.
2022-11-01 20:31:22 +00:00
</member>
2023-10-26 11:44:09 +00:00
<member name= "blackboard" type= "Blackboard" setter= "set_blackboard" getter= "get_blackboard" >
Holds data shared by the behavior tree tasks. See [Blackboard].
2022-11-01 20:31:22 +00:00
</member>
2024-01-25 13:56:59 +00:00
<member name= "blackboard_plan" type= "BlackboardPlan" setter= "set_blackboard_plan" getter= "get_blackboard_plan" >
Stores and manages variables that will be used in constructing new [Blackboard] instances.
</member>
2023-07-20 20:15:30 +00:00
<member name= "monitor_performance" type= "bool" setter= "_set_monitor_performance" getter= "_get_monitor_performance" default= "false" >
2023-10-26 11:44:09 +00:00
If [code]true[/code], adds a performance monitor to "Debugger-> Monitors" for each instance of this [BTPlayer] node.
2023-07-20 20:15:30 +00:00
</member>
2023-04-10 14:57:36 +00:00
<member name= "update_mode" type= "int" setter= "set_update_mode" getter= "get_update_mode" enum= "BTPlayer.UpdateMode" default= "1" >
2023-10-26 11:44:09 +00:00
Determines when the behavior tree is executed. See [enum UpdateMode].
2022-11-01 20:31:22 +00:00
</member>
</members>
<signals >
2024-08-03 14:11:47 +00:00
<signal name= "behavior_tree_finished" deprecated= "Use [signal updated] signal instead." >
2024-03-04 20:36:16 +00:00
<param index= "0" name= "status" type= "int" />
2022-11-01 20:31:22 +00:00
<description >
2023-10-26 11:44:09 +00:00
Emitted when the behavior tree has finished executing and returned [code]SUCCESS[/code] or [code]FAILURE[/code].
2024-03-04 20:36:16 +00:00
Argument [param status] holds the status returned by the behavior tree. See [enum BT.Status].
2022-11-01 20:31:22 +00:00
</description>
</signal>
2023-07-20 20:15:30 +00:00
<signal name= "updated" >
2024-03-04 20:36:16 +00:00
<param index= "0" name= "status" type= "int" />
2023-07-20 20:15:30 +00:00
<description >
2023-10-26 11:44:09 +00:00
Emitted when BTPlayer has finished the behavior tree update.
2024-03-04 20:36:16 +00:00
Argument [param status] holds the status returned by the behavior tree. See [enum BT.Status].
2023-07-20 20:15:30 +00:00
</description>
</signal>
2022-11-01 20:31:22 +00:00
</signals>
<constants >
<constant name= "IDLE" value= "0" enum= "UpdateMode" >
2023-10-26 11:44:09 +00:00
Execute behavior tree during the idle process.
2022-11-01 20:31:22 +00:00
</constant>
<constant name= "PHYSICS" value= "1" enum= "UpdateMode" >
2023-10-26 11:44:09 +00:00
Execute behavior tree during the physics process.
2022-11-01 20:31:22 +00:00
</constant>
<constant name= "MANUAL" value= "2" enum= "UpdateMode" >
2023-10-26 11:44:09 +00:00
Behavior tree is executed manually by calling [method update].
2022-11-01 20:31:22 +00:00
</constant>
</constants>
</class>