This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
dragengine:modules:dragonscript:behavior_lookat [2025/03/13 17:09] – dragonlord | dragengine:modules:dragonscript:behavior_lookat [2025/05/04 13:44] (current) – [lookAt.check] dragonlord | ||
---|---|---|---|
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|'' | ||
+ | |lookAt|'' | ||
+ | |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|'' | ||
+ | |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> | ||
+ | < | ||
+ | <action name=' | ||
+ | < | ||
+ | </ | ||
+ | <!-- actions here run only if looking at player --> | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ====== 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|'' | ||
+ | |lookAt.lookAt|'' | ||
+ | |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|'' | ||
+ | |||
+ | This is an example of using this condition: | ||
+ | <code xml> | ||
+ | <action name=' | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ====== State Machine Actions ====== | ||
+ | |||
+ | Same as [[# | ||
+ | |||
+ | ====== State Machine Conditions ====== | ||
+ | |||
+ | Same as [[# | ||
+ | |||
+ | ====== 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 67: | Line 144: | ||
* [[behavior_component|ECBehaviorComponent]]: | * [[behavior_component|ECBehaviorComponent]]: | ||
* [[behavior_locomotion|ECBehaviorLocomotion]]: | * [[behavior_locomotion|ECBehaviorLocomotion]]: | ||
+ | * [[behavior_behaviortree|ECBehaviorBehaviorTree]]: | ||
+ | * [[behavior_statemachine|ECBehaviorStateMachine]]: | ||
====== Persistency ====== | ====== Persistency ====== | ||
Line 126: | Line 205: | ||
<!-- optional: use component with id instead of empty string --> | <!-- optional: use component with id instead of empty string --> | ||
<string name=' | <string name=' | ||
+ | | ||
+ | <!-- optional: use behavior tree with id instead of empty string --> | ||
+ | <string name=' | ||
+ | | ||
+ | <!-- optional: use state machine with id instead of empty string --> | ||
+ | <string name=' | ||
| | ||
<!-- set element properties. omit property prefix if used inside behavior tag --> | <!-- set element properties. omit property prefix if used inside behavior tag --> |