From d393784bbe276608995d45a86e1b637f11ddf78a Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Sun, 18 Feb 2024 20:50:09 +0100 Subject: [PATCH] Doc: Update accessing-nodes.rst --- .../getting-started/accessing-nodes.rst | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/doc/source/getting-started/accessing-nodes.rst b/doc/source/getting-started/accessing-nodes.rst index fa6bf72..6774f93 100644 --- a/doc/source/getting-started/accessing-nodes.rst +++ b/doc/source/getting-started/accessing-nodes.rst @@ -3,28 +3,37 @@ Accessing nodes in the scene tree ================================= -There are several ways to access nodes in the agent's scene tree (agent is the owner of :ref:`BTPlayer` node): +There are several ways to access nodes in the agent's scene tree. -1. You can export a :ref:`BBNode` variable: + **🛈 Note:** Agent is the owner of :ref:`BTPlayer` node. + + +With ``BBNode`` property +------------------------ .. code:: gdscript - @export var cast: BBNode + @export var cast_param: BBNode func _tick(delta) -> Status: - var node: ShapeCast3D = cast.get_value(agent, blackboard) + var node: ShapeCast3D = cast_param.get_value(agent, blackboard) -2. You can export a ``NodePath`` + +With ``NodePath`` property +-------------------------- .. code:: gdscript @export var cast_path: NodePath - var _shape_cast: ShapeCast3D - func _setup() -> void: - _shape_cast = agent.get_node(cast_path) + func _tick(delta) -> Status: + var node: ShapeCast3D = agent.get_node(cast_path) -3. You can :ref:`create a blackboard variable` in the editor with the type ``NodePath`` + +Using blackboard plan +--------------------- + +You can :ref:`create a blackboard variable` in the editor with the type ``NodePath`` and point it to the proper node in the :ref:`BTPlayer` blackboard plan. .. code:: gdscript