2024-01-12 20:05:50 +00:00
:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
2024-07-20 15:25:24 +00:00
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/modules/limboai/doc_classes/BTPlayer.xml.
2024-01-12 20:05:50 +00:00
.. _class_BTPlayer:
BTPlayer
========
**Inherits:**
Player of :ref: `BehaviorTree<class_BehaviorTree>` resources.
.. rst-class :: classref-introduction-group
Description
-----------
2024-05-02 17:35:42 +00:00
**BTPlayer** node is used to instantiate and play :ref: `BehaviorTree<class_BehaviorTree>` resources at runtime. During initialization, the behavior tree instance is given references to the agent, the :ref: `blackboard<class_BTPlayer_property_blackboard>` , and the current scene root. The agent can be specified by the :ref: `agent_node<class_BTPlayer_property_agent_node>` property (defaults to the BTPlayer's parent node).
2024-01-12 20:05:50 +00:00
For an introduction to behavior trees, see :ref: `BehaviorTree<class_BehaviorTree>` .
.. rst-class :: classref-reftable-group
Properties
----------
.. table ::
:widths: auto
2024-05-02 11:39:19 +00:00
+---------------------------------------------+-------------------------------------------------------------------------+--------------------+
2024-07-20 15:25:24 +00:00
| `` bool `` | :ref: `active<class_BTPlayer_property_active>` | `` true `` |
2024-05-02 11:39:19 +00:00
+---------------------------------------------+-------------------------------------------------------------------------+--------------------+
2024-07-20 15:25:24 +00:00
| `` NodePath `` | :ref: `agent_node<class_BTPlayer_property_agent_node>` | `` NodePath("..") `` |
2024-05-02 11:39:19 +00:00
+---------------------------------------------+-------------------------------------------------------------------------+--------------------+
| :ref: `BehaviorTree<class_BehaviorTree>` | :ref: `behavior_tree<class_BTPlayer_property_behavior_tree>` | |
+---------------------------------------------+-------------------------------------------------------------------------+--------------------+
| :ref: `Blackboard<class_Blackboard>` | :ref: `blackboard<class_BTPlayer_property_blackboard>` | |
+---------------------------------------------+-------------------------------------------------------------------------+--------------------+
| :ref: `BlackboardPlan<class_BlackboardPlan>` | :ref: `blackboard_plan<class_BTPlayer_property_blackboard_plan>` | |
+---------------------------------------------+-------------------------------------------------------------------------+--------------------+
2024-07-20 15:25:24 +00:00
| `` bool `` | :ref: `monitor_performance<class_BTPlayer_property_monitor_performance>` | `` false `` |
2024-05-02 11:39:19 +00:00
+---------------------------------------------+-------------------------------------------------------------------------+--------------------+
| :ref: `UpdateMode<enum_BTPlayer_UpdateMode>` | :ref: `update_mode<class_BTPlayer_property_update_mode>` | `` 1 `` |
+---------------------------------------------+-------------------------------------------------------------------------+--------------------+
2024-01-12 20:05:50 +00:00
.. rst-class :: classref-reftable-group
Methods
-------
.. table ::
:widths: auto
2024-08-03 11:14:31 +00:00
+-------------------------------------+----------------------------------------------------------------------+
| :ref: `BTInstance<class_BTInstance>` | :ref: `get_bt_instance<class_BTPlayer_method_get_bt_instance>` \ (\ ) |
+-------------------------------------+----------------------------------------------------------------------+
| |void| | :ref: `restart<class_BTPlayer_method_restart>` \ (\ ) |
+-------------------------------------+----------------------------------------------------------------------+
| |void| | :ref: `update<class_BTPlayer_method_update>` \ (\ delta\: `` float ` ` \ ) |
+-------------------------------------+----------------------------------------------------------------------+
2024-01-12 20:05:50 +00:00
.. rst-class :: classref-section-separator
----
.. rst-class :: classref-descriptions-group
Signals
-------
.. _class_BTPlayer_signal_behavior_tree_finished:
.. rst-class :: classref-signal
2024-07-20 15:25:24 +00:00
**behavior_tree_finished** \ (\ status\: `` int ` ` \ ) :ref: ` 🔗<class_BTPlayer_signal_behavior_tree_finished> `
2024-01-12 20:05:50 +00:00
Emitted when the behavior tree has finished executing and returned `` SUCCESS `` or `` FAILURE `` .
2024-03-04 20:36:16 +00:00
Argument `` status `` holds the status returned by the behavior tree. See :ref: `Status<enum_BT_Status>` .
2024-01-12 20:05:50 +00:00
.. rst-class :: classref-item-separator
----
.. _class_BTPlayer_signal_updated:
.. rst-class :: classref-signal
2024-07-20 15:25:24 +00:00
**updated** \ (\ status\: `` int ` ` \ ) :ref: ` 🔗<class_BTPlayer_signal_updated> `
2024-01-12 20:05:50 +00:00
Emitted when BTPlayer has finished the behavior tree update.
2024-03-04 20:36:16 +00:00
Argument `` status `` holds the status returned by the behavior tree. See :ref: `Status<enum_BT_Status>` .
2024-01-12 20:05:50 +00:00
.. rst-class :: classref-section-separator
----
.. rst-class :: classref-descriptions-group
Enumerations
------------
.. _enum_BTPlayer_UpdateMode:
.. rst-class :: classref-enumeration
2024-07-20 15:25:24 +00:00
enum **UpdateMode** : :ref: `🔗<enum_BTPlayer_UpdateMode>`
2024-01-12 20:05:50 +00:00
.. _class_BTPlayer_constant_IDLE:
.. rst-class :: classref-enumeration-constant
:ref: `UpdateMode<enum_BTPlayer_UpdateMode>` **IDLE** = `` 0 ``
Execute behavior tree during the idle process.
.. _class_BTPlayer_constant_PHYSICS:
.. rst-class :: classref-enumeration-constant
:ref: `UpdateMode<enum_BTPlayer_UpdateMode>` **PHYSICS** = `` 1 ``
Execute behavior tree during the physics process.
.. _class_BTPlayer_constant_MANUAL:
.. rst-class :: classref-enumeration-constant
:ref: `UpdateMode<enum_BTPlayer_UpdateMode>` **MANUAL** = `` 2 ``
Behavior tree is executed manually by calling :ref: `update<class_BTPlayer_method_update>` .
.. rst-class :: classref-section-separator
----
.. rst-class :: classref-descriptions-group
Property Descriptions
---------------------
.. _class_BTPlayer_property_active:
.. rst-class :: classref-property
2024-07-20 15:25:24 +00:00
`` bool `` **active** = `` true `` :ref: `🔗<class_BTPlayer_property_active>`
2024-01-12 20:05:50 +00:00
.. rst-class :: classref-property-setget
2024-07-20 15:25:24 +00:00
- |void| **set_active** \ (\ value\: `` bool ` ` \ )
- `` bool `` **get_active** \ (\ )
2024-01-12 20:05:50 +00:00
If `` true `` , the behavior tree will be executed during update.
.. rst-class :: classref-item-separator
----
2024-05-02 11:39:19 +00:00
.. _class_BTPlayer_property_agent_node:
.. rst-class :: classref-property
2024-07-20 15:25:24 +00:00
`` NodePath `` **agent_node** = `` NodePath("..") `` :ref: `🔗<class_BTPlayer_property_agent_node>`
2024-05-02 11:39:19 +00:00
.. rst-class :: classref-property-setget
2024-07-20 15:25:24 +00:00
- |void| **set_agent_node** \ (\ value\: `` NodePath ` ` \ )
- `` NodePath `` **get_agent_node** \ (\ )
2024-05-02 11:39:19 +00:00
Path to the node that will be used as the agent. Setting it after instantiation will have no effect.
.. rst-class :: classref-item-separator
----
2024-01-12 20:05:50 +00:00
.. _class_BTPlayer_property_behavior_tree:
.. rst-class :: classref-property
2024-07-20 15:25:24 +00:00
:ref: `BehaviorTree<class_BehaviorTree>` **behavior_tree** :ref: `🔗<class_BTPlayer_property_behavior_tree>`
2024-01-12 20:05:50 +00:00
.. rst-class :: classref-property-setget
2024-07-20 15:25:24 +00:00
- |void| **set_behavior_tree** \ (\ value\: :ref: `BehaviorTree<class_BehaviorTree>` \ )
- :ref: `BehaviorTree<class_BehaviorTree>` **get_behavior_tree** \ (\ )
2024-01-12 20:05:50 +00:00
:ref: `BehaviorTree<class_BehaviorTree>` resource to instantiate and execute at runtime.
.. rst-class :: classref-item-separator
----
.. _class_BTPlayer_property_blackboard:
.. rst-class :: classref-property
2024-07-20 15:25:24 +00:00
:ref: `Blackboard<class_Blackboard>` **blackboard** :ref: `🔗<class_BTPlayer_property_blackboard>`
2024-01-12 20:05:50 +00:00
.. rst-class :: classref-property-setget
2024-07-20 15:25:24 +00:00
- |void| **set_blackboard** \ (\ value\: :ref: `Blackboard<class_Blackboard>` \ )
- :ref: `Blackboard<class_Blackboard>` **get_blackboard** \ (\ )
2024-01-12 20:05:50 +00:00
Holds data shared by the behavior tree tasks. See :ref: `Blackboard<class_Blackboard>` .
.. rst-class :: classref-item-separator
----
2024-01-25 13:56:59 +00:00
.. _class_BTPlayer_property_blackboard_plan:
.. rst-class :: classref-property
2024-07-20 15:25:24 +00:00
:ref: `BlackboardPlan<class_BlackboardPlan>` **blackboard_plan** :ref: `🔗<class_BTPlayer_property_blackboard_plan>`
2024-01-25 13:56:59 +00:00
.. rst-class :: classref-property-setget
2024-07-20 15:25:24 +00:00
- |void| **set_blackboard_plan** \ (\ value\: :ref: `BlackboardPlan<class_BlackboardPlan>` \ )
- :ref: `BlackboardPlan<class_BlackboardPlan>` **get_blackboard_plan** \ (\ )
2024-01-25 13:56:59 +00:00
Stores and manages variables that will be used in constructing new :ref: `Blackboard<class_Blackboard>` instances.
.. rst-class :: classref-item-separator
----
2024-01-12 20:05:50 +00:00
.. _class_BTPlayer_property_monitor_performance:
.. rst-class :: classref-property
2024-07-20 15:25:24 +00:00
`` bool `` **monitor_performance** = `` false `` :ref: `🔗<class_BTPlayer_property_monitor_performance>`
2024-01-12 20:05:50 +00:00
If `` true `` , adds a performance monitor to "Debugger->Monitors" for each instance of this **BTPlayer** node.
.. rst-class :: classref-item-separator
----
.. _class_BTPlayer_property_update_mode:
.. rst-class :: classref-property
2024-07-20 15:25:24 +00:00
:ref: `UpdateMode<enum_BTPlayer_UpdateMode>` **update_mode** = `` 1 `` :ref: `🔗<class_BTPlayer_property_update_mode>`
2024-01-12 20:05:50 +00:00
.. rst-class :: classref-property-setget
2024-07-20 15:25:24 +00:00
- |void| **set_update_mode** \ (\ value\: :ref: `UpdateMode<enum_BTPlayer_UpdateMode>` \ )
- :ref: `UpdateMode<enum_BTPlayer_UpdateMode>` **get_update_mode** \ (\ )
2024-01-12 20:05:50 +00:00
Determines when the behavior tree is executed. See :ref: `UpdateMode<enum_BTPlayer_UpdateMode>` .
.. rst-class :: classref-section-separator
----
.. rst-class :: classref-descriptions-group
Method Descriptions
-------------------
2024-08-03 11:14:31 +00:00
.. _class_BTPlayer_method_get_bt_instance:
2024-01-12 20:05:50 +00:00
.. rst-class :: classref-method
2024-08-03 11:14:31 +00:00
:ref: `BTInstance<class_BTInstance>` **get_bt_instance** \ (\ ) :ref: `🔗<class_BTPlayer_method_get_bt_instance>`
2024-01-12 20:05:50 +00:00
2024-08-03 11:14:31 +00:00
Returns the behavior tree instance.
2024-02-14 19:34:18 +00:00
.. rst-class :: classref-item-separator
----
2024-01-12 20:05:50 +00:00
.. _class_BTPlayer_method_restart:
.. rst-class :: classref-method
2024-07-20 15:25:24 +00:00
|void| **restart** \ (\ ) :ref: `🔗<class_BTPlayer_method_restart>`
2024-01-12 20:05:50 +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 :ref: `Blackboard<class_Blackboard>` .
.. rst-class :: classref-item-separator
----
.. _class_BTPlayer_method_update:
.. rst-class :: classref-method
2024-07-20 15:25:24 +00:00
|void| **update** \ (\ delta\: `` float ` ` \ ) :ref: ` 🔗<class_BTPlayer_method_update> `
2024-01-12 20:05:50 +00:00
Executes the root task of the behavior tree instance if :ref: `active<class_BTPlayer_property_active>` is `` true `` . Call this method when :ref: `update_mode<class_BTPlayer_property_update_mode>` is set to :ref: `MANUAL<class_BTPlayer_constant_MANUAL>` . When :ref: `update_mode<class_BTPlayer_property_update_mode>` is not :ref: `MANUAL<class_BTPlayer_constant_MANUAL>` , the :ref: `update<class_BTPlayer_method_update>` will be called automatically. See :ref: `UpdateMode<enum_BTPlayer_UpdateMode>` .
.. |virtual| replace :: :abbr: `virtual (This method should typically be overridden by the user to have any effect.)`
.. |const| replace :: :abbr: `const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
.. |vararg| replace :: :abbr: `vararg (This method accepts any number of arguments after the ones described here.)`
.. |constructor| replace :: :abbr: `constructor (This method is used to construct a type.)`
.. |static| replace :: :abbr: `static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
.. |operator| replace :: :abbr: `operator (This method describes a valid operator to use with this type as left-hand operand.)`
.. |bitfield| replace :: :abbr: `BitField (This value is an integer composed as a bitmask of the following flags.)`
2024-07-20 15:25:24 +00:00
.. |void| replace :: :abbr: `void (No return value.)`