User Tools

Site Tools


dragengine:modules:dragonscript:behavior_lookat

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dragengine:modules:dragonscript:behavior_lookat [2025/05/02 15:50] dragonlorddragengine:modules:dragonscript:behavior_lookat [2025/05/13 13:57] (current) dragonlord
Line 59: Line 59:
 ====== Behavior Tree Actions ====== ====== Behavior Tree Actions ======
  
-This behavior adds these behavior tree actions if behavior tree is present. If behavior has non-empty identifier replace ''lookAt'' with ''lookAt(id)''.+This behavior adds these behavior tree actions if behavior tree is present. 
 + 
 +===== lookAt.update ===== 
 + 
 +Update look-at. 
 + 
 +^Parameter^Value^Description^ 
 +|interact|string|Interact with looked-at element. If element is absent action fails. Runs interaction with name value. If interaction with name value is absent fails action. If interaction returns false fails action. Otherwise action succeeds.| 
 +|interact.parameters|string|Optional parameters to use with ''interaction''.| 
 +|interactElement.assign|string|Assign look-at element to [[behavior_interactelement|ECBehaviorInteractElement]] with identifier matching value string. Action fails if no element is looked at or interact element behavior is absent| 
 + 
 +This is an example of using this action: 
 +<code xml> 
 +<action name='lookAt.update'
 +  <parameter name='interactElement.assign'/> 
 +</action> 
 +</code>
  
 ===== lookAt.check ===== ===== lookAt.check =====
Line 71: Line 87:
 |lookAt.distance.greater|float|Distance to look-at element is greater than value meters| |lookAt.distance.greater|float|Distance to look-at element is greater than value meters|
 |lookAt.player|''true'', ''false''|Is looking at player| |lookAt.player|''true'', ''false''|Is looking at player|
 +|interact.name|string|Name of interaction|
 +|interact.has|''true'', ''false''|Element is looked-at and interaction with name ''interaction.name'' is present|
 +|interact.query|''true'', ''false''|Interact with looked-at element and test result. Condition is true if element is looked-at, interaction with name ''interaction.name'' is present and interaction returns true. It is recommended to use here only interactions without side effects (hence query interactions).|
 +|interact.parameters|string|Optional parameters to use with ''interaction.query''.|
 +|wait| |If present action returns BTResult.running instead of BTResult.failed to wait until the checks are all fulfilled|
  
 This is an example of using this action: This is an example of using this action:
Line 84: Line 105:
 ====== Behavior Tree Conditions ====== ====== Behavior Tree Conditions ======
  
-This behavior adds these behavior tree conditions if behavior tree is present. If behavior has non-empty identifier replace ''lookAt'' with ''lookAt(id)''.+This behavior adds these behavior tree conditions if behavior tree is present.
  
 ===== lookAt.check ===== ===== lookAt.check =====
Line 96: Line 117:
 |lookAt.lookAt.distance.greater|float|Distance to look-at element is greater than value meters| |lookAt.lookAt.distance.greater|float|Distance to look-at element is greater than value meters|
 |lookAt.lookAt.player|''true'', ''false''|Is looking at player| |lookAt.lookAt.player|''true'', ''false''|Is looking at player|
 +|lookAt.interact.name|string|Name of interaction|
 +|lookAt.interact.has|''true'', ''false''|Element is looked-at and interaction with name ''interaction.name'' is present|
 +|lookAt.interact.query|''true'', ''false''|Interact with looked-at element and test result. Condition is true if element is looked-at, interaction with name ''interaction.name'' is present and interaction returns true. It is recommended to use here only interactions without side effects (hence query interactions).|
 +|lookAt.interact.parameters|string|Optional parameters to use with ''interaction.query''.|
  
 This is an example of using this condition: This is an example of using this condition:
Line 104: Line 129:
 </action> </action>
 </code> </code>
 +
 +====== State Machine Actions ======
 +
 +Same as [[#behavior_tree_actions|Behavior Tree Actions]].
 +
 +====== State Machine Conditions ======
 +
 +Same as [[#behavior_tree_conditions|Behavior Tree Conditions]].
 +
 +====== State Machine Events ======
 +
 +This behavior sends these state machine events.
 +
 +===== lookAt.enabled =====
 +
 +Look-at has been enabled.
 +
 +===== lookAt.disabled =====
 +
 +Look-at has been disabled.
 +
 +===== lookAt.lookAt =====
 +
 +Looking at an element. Send if looking at an element when previously not looking at an element or looking at a different element.
 +
 +===== lookAt.noLookAt =====
 +
 +Not looking at an element. Send if not looking at an element when previously has been looking at an element.
  
 ====== Required Behaviors ====== ====== Required Behaviors ======
Line 116: Line 169:
   * [[behavior_locomotion|ECBehaviorLocomotion]]: Use lcomotion looking state to direct test ray cast direction   * [[behavior_locomotion|ECBehaviorLocomotion]]: Use lcomotion looking state to direct test ray cast direction
   * [[behavior_behaviortree|ECBehaviorBehaviorTree]]: Add actions and conditions for behavior trees to use.   * [[behavior_behaviortree|ECBehaviorBehaviorTree]]: Add actions and conditions for behavior trees to use.
 +  * [[behavior_statemachine|ECBehaviorStateMachine]]: Add actions and conditions for state machine to use and events to send to the state machine.
  
 ====== Persistency ====== ====== Persistency ======
Line 175: Line 229:
     <!-- optional: use component with id instead of empty string -->     <!-- optional: use component with id instead of empty string -->
     <string name='component'>second</string>     <string name='component'>second</string>
 +    
 +    <!-- optional: use behavior tree with id instead of empty string -->
 +    <string name='behaviorTree'>second</string>
 +    
 +    <!-- optional: use state machine with id instead of empty string -->
 +    <string name='stateMachine'>second</string>
          
     <!-- set element properties. omit property prefix if used inside behavior tag -->     <!-- set element properties. omit property prefix if used inside behavior tag -->
dragengine/modules/dragonscript/behavior_lookat.1746201017.txt.gz · Last modified: 2025/05/02 15:50 by dragonlord