This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
dragengine:modules:dragonscript:behavior_hitscan [2025/03/11 15:57] – dragonlord | dragengine:modules:dragonscript:behavior_hitscan [2025/05/04 13:40] (current) – [hitScan.check] dragonlord | ||
---|---|---|---|
Line 1: | Line 1: | ||
{{tag> | {{tag> | ||
<WRAP youarehere> | <WRAP youarehere> | ||
- | [[: | + | [[: |
</ | </ | ||
Line 63: | Line 63: | ||
* Example (*.deeclass) <code xml>< | * Example (*.deeclass) <code xml>< | ||
- | ===== Events ===== | + | ====== Events |
This behavior has no events | This behavior has no events | ||
+ | |||
+ | ====== Behavior Tree Actions ====== | ||
+ | |||
+ | This behavior adds these behavior tree actions if behavior tree is present. If behavior has non-empty identifier replace '' | ||
+ | |||
+ | ===== hitScan.start ===== | ||
+ | |||
+ | Start hit scans. | ||
+ | |||
+ | ^Parameter^Value^Description^ | ||
+ | |type|'' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | </ | ||
+ | |count|integer|Count of collision tests to start| | ||
+ | |count.horizontal|integer|Horizontal count of collision tests to start| | ||
+ | |count.vertical|integer|Vertical count of collision tests to start| | ||
+ | |angle|float|Opening angle in degrees (angle across diameter)| | ||
+ | |angle.horizontal|float|Horizontal opening angle in degrees (angle across width)| | ||
+ | |angle.vertical|float|Vertical opening angle in degrees (angle across height)| | ||
+ | |||
+ | This is an example of using this action: | ||
+ | <code xml> | ||
+ | <action name=' | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ===== hitScan.stop ===== | ||
+ | |||
+ | Stop hit scans. | ||
+ | |||
+ | ^Parameter^Value^Description^ | ||
+ | |clear| |Clear hit results as if no hit has been done| | ||
+ | |||
+ | This is an example of using this action: | ||
+ | <code xml> | ||
+ | <action name=' | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ===== hitScan.check ===== | ||
+ | |||
+ | Check one or more hit scan parameters. Action succeeds if all parameter value matches their respective hit scan parameter otherwise action fails. This action is typically used as first action in a sequence to run the sequence only if a hit scan parameter matches (or not). | ||
+ | |||
+ | ^Parameter^Value^Description^ | ||
+ | |running|'' | ||
+ | |hits|integer|Count of hits equals integer value| | ||
+ | |hits.not|integer|Count of hits does not equal integer value| | ||
+ | |hits.less|integer|Count of hits is less than integer value| | ||
+ | |hits.greater|integer|Count of hits is greater than integer value| | ||
+ | |hits.percentage.less|integer|Percentage of hits is less than value in the range from 0 to 1| | ||
+ | |hits.percentage.greater|integer|Percentage of hits is greater than value in the range from 0 to 1| | ||
+ | |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 hit scans finished and more than 50% hits have been found --> | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ====== Behavior Tree Conditions ====== | ||
+ | |||
+ | This behavior adds these behavior tree conditions if behavior tree is present. If behavior has non-empty identifier replace '' | ||
+ | |||
+ | ===== hitScan.check ===== | ||
+ | |||
+ | Check one or more hit scan parameters. Conditions returns true if all parameter value match their respective hit scan parameter. This condition is typically used to run an action or sequence of actions as long as hit scan conditions are true. | ||
+ | |||
+ | ^Parameter^Value^Description^ | ||
+ | |hitScan.running|'' | ||
+ | |hitScan.hits|integer|Count of hits equals integer value| | ||
+ | |hitScan.hits.not|integer|Count of hits does not equal integer value| | ||
+ | |hitScan.hits.less|integer|Count of hits is less than integer value| | ||
+ | |hitScan.hits.greater|integer|Count of hits is greater than integer value| | ||
+ | |hitScan.hits.percentage.less|integer|Percentage of hits is less than value in the range from 0 to 1| | ||
+ | |hitScan.hits.percentage.greater|integer|Percentage of hits is greater than value in the range from 0 to 1| | ||
+ | |||
+ | 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. If behavior has non-empty identifier replace '' | ||
+ | |||
+ | ===== hitScan.done ===== | ||
+ | |||
+ | Hit scan finished and the results can be examine now. | ||
====== Required Behaviors ====== | ====== Required Behaviors ====== | ||
- | This behavior requires these other behaviors: | ||
* [[behavior_collider|ECBehaviorCollider]]: | * [[behavior_collider|ECBehaviorCollider]]: | ||
====== Optional Behaviors ====== | ====== Optional Behaviors ====== | ||
- | This behavior does support these optional behaviors: | ||
* [[behavior_component|ECBehaviorComponent]]: | * [[behavior_component|ECBehaviorComponent]]: | ||
+ | * [[behavior_behaviortree|ECBehaviorBehaviorTree]]: | ||
+ | * [[behavior_statemachine|ECBehaviorStateMachine]]: | ||
====== Persistency ====== | ====== Persistency ====== | ||
Line 131: | Line 243: | ||
are a list of bits to set. --> | are a list of bits to set. --> | ||
<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 --> |