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

Next revision
Previous revision
dragengine:modules:dragonscript:behavior_lookat [2025/03/12 11:31] – created dragonlorddragengine:modules:dragonscript:behavior_lookat [2025/05/04 13:44] (current) – [lookAt.check] dragonlord
Line 1: Line 1:
 {{tag>dragonscript behavior}} {{tag>dragonscript behavior}}
 <WRAP youarehere> <WRAP youarehere>
-[[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[abstractions#behavior_elementsquick_and_easy_development|Behavior Elements: Quick and Easy Development]] >> **ECBehaviorLookAt**+[[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[dragengine:modules:dragonscript:abstractions|Abstraction Layers: How you want to build your Game]] >> [[dragengine:modules:dragonscript:behavior_elements|Behavior Elements]] >> **ECBehaviorLookAt**
 </WRAP> </WRAP>
  
Line 56: Line 56:
  
 Looking at element changed. Looking at element changed.
 +
 +====== Behavior Tree Actions ======
 +
 +This behavior adds these behavior tree actions if behavior tree is present.
 +
 +===== lookAt.check =====
 +
 +Check one or more look-at parameters. Action succeeds if all parameter value matches their respective look-at parameter otherwise action fails. This action is typically used as first action in a sequence to run the sequence only if a look-at parameter matches (or not).
 +
 +^Parameter^Value^Description^
 +|enabled|''true'', ''false''|Look-at is enabled|
 +|lookAt|''true'', ''false''|Is looking at element|
 +|lookAt.distance.less|float|Distance to look-at element is less 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|
 +|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:
 +<code xml>
 +<sequence>
 +  <action name='lookAt.check'>
 +    <parameter name='lookAt.player'>true</parameter>
 +  </action>
 +  <!-- actions here run only if looking at player -->
 +</sequence>
 +</code>
 +
 +====== Behavior Tree Conditions ======
 +
 +This behavior adds these behavior tree conditions if behavior tree is present.
 +
 +===== lookAt.check =====
 +
 +Check one or more look-at parameters. Conditions returns true if all parameter value match their respective look-at parameter. This condition is typically used to run an action or sequence of actions as long as look-at conditions are true.
 +
 +^Parameter^Value^Description^
 +|enabled|''true'', ''false''|Look-at is enabled|
 +|lookAt.lookAt|''true'', ''false''|Is looking at element|
 +|lookAt.lookAt.distance.less|float|Distance to look-at element is less 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|
 +
 +This is an example of using this condition:
 +<code xml>
 +<action name='myAction' id='doing something'>
 +  <parameter name='lookAt.enabled'>true</parameter>
 +  <condition>lookAt.check</condition>
 +</action>
 +</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 63: Line 140:
 ====== Optional Behaviors ====== ====== Optional Behaviors ======
  
-This behavior does support these optional behaviors: 
   * [[behavior_colliderai|ECBehaviorColliderAI]]: Cast test ray relative to collider   * [[behavior_colliderai|ECBehaviorColliderAI]]: Cast test ray relative to collider
   * [[behavior_collider|ECBehaviorCollider]]: Cast test ray relative to collider   * [[behavior_collider|ECBehaviorCollider]]: Cast test ray relative to collider
   * [[behavior_component|ECBehaviorComponent]]: Cast test ray from bone from component   * [[behavior_component|ECBehaviorComponent]]: Cast test ray from bone from component
   * [[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_statemachine|ECBehaviorStateMachine]]: Add actions and conditions for state machine to use and events to send to the state machine.
  
 ====== Persistency ====== ====== Persistency ======
Line 127: Line 205:
     <!-- 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.1741779111.txt.gz · Last modified: 2025/03/12 11:31 by dragonlord