This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
dragengine:modules:dragonscript:behavior_colliderai [2025/03/12 10:55] – created dragonlord | dragengine:modules:dragonscript:behavior_colliderai [2025/05/11 13:17] (current) – [colliderAI.update] dragonlord | ||
---|---|---|---|
Line 1: | Line 1: | ||
{{tag> | {{tag> | ||
<WRAP youarehere> | <WRAP youarehere> | ||
- | [[: | + | [[: |
</ | </ | ||
Line 17: | Line 17: | ||
In contrary to [[behavior_collider|ECBehaviorCollider]] this behavior does synchronize position with the element position but not vice versa. Actors typically have complex requirements on how their AI collider can move including projecting down to the ground after physics processing has finished. Behaviors suitable for managing collider AI typically update the AI collider velocities during think() and update element position and orientation from AI collider during postThink(). | In contrary to [[behavior_collider|ECBehaviorCollider]] this behavior does synchronize position with the element position but not vice versa. Actors typically have complex requirements on how their AI collider can move including projecting down to the ground after physics processing has finished. Behaviors suitable for managing collider AI typically update the AI collider velocities during think() and update element position and orientation from AI collider during postThink(). | ||
+ | See also: | ||
+ | * [[gamedev: | ||
====== Instance Counts ====== | ====== Instance Counts ====== | ||
This behavior can be used only once on an element. | This behavior can be used only once on an element. | ||
Line 38: | Line 40: | ||
Collider changed. | Collider changed. | ||
+ | |||
+ | ====== Behavior Tree Actions ====== | ||
+ | |||
+ | This behavior adds these behavior tree actions if behavior tree is present. | ||
+ | |||
+ | ===== colliderAI.set ===== | ||
+ | |||
+ | Set one or more collider ai parameters. | ||
+ | |||
+ | ^Parameter^Value^Description^ | ||
+ | |enabled|'' | ||
+ | |gravity|vector3|Set gravity| | ||
+ | |shape|'' | ||
+ | |shape.radius|float|Set radius in meters of humanoid shape| | ||
+ | |shape.height|float|Set height in meters of humanoid shape| | ||
+ | |||
+ | This is an example of using this action: | ||
+ | <code xml> | ||
+ | <action name=' | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ===== colliderAI.update ===== | ||
+ | |||
+ | Update collider ai. | ||
+ | |||
+ | ^Parameter^Value^Description^ | ||
+ | |gravity.apply| |Apply gravity to linear velocity of collider| | ||
+ | |geometryFromCollider| |Set element position and orientation from collider| | ||
+ | |stop.turning| |Clear angular velocity of collider| | ||
+ | |stop.moving| |Clear linear velocity of collider| | ||
+ | |||
+ | This is an example of using this action: | ||
+ | <code xml> | ||
+ | <action name=' | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ===== colliderAI.collision ===== | ||
+ | |||
+ | Handle collisions. | ||
+ | |||
+ | ^Parameter^Value^Description^ | ||
+ | |stop| |Stop collider from moving. Prevents any further collision in this frame update.| | ||
+ | |sliding| |Applies sliding collision response| | ||
+ | |||
+ | This is an example of using this action: | ||
+ | <code xml> | ||
+ | <action name=' | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ===== colliderAI.check ===== | ||
+ | |||
+ | Check one or more collider ai parameters. Action succeeds if all parameter value matches their respective collider ai parameter otherwise action fails. This action is typically used as first action in a sequence to run the sequence only if a collider ai parameter matches (or not). | ||
+ | |||
+ | ^Parameter^Value^Description^ | ||
+ | |enabled|'' | ||
+ | |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 collider ai is enabled --> | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ====== Behavior Tree Conditions ====== | ||
+ | |||
+ | This behavior adds these behavior tree conditions if behavior tree is present. | ||
+ | |||
+ | ===== colliderAI.check ===== | ||
+ | |||
+ | Check one or more collider ai parameters. Conditions returns true if all parameter value match their respective collider ai parameter. This condition is typically used to run an action or sequence of actions as long as collider ai conditions are true. | ||
+ | |||
+ | ^Parameter^Value^Description^ | ||
+ | |colliderAI.enabled|'' | ||
+ | |||
+ | 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 no state machine events. | ||
====== Required Behaviors ====== | ====== Required Behaviors ====== | ||
- | This behavior requires these other behaviors: | ||
* [[behavior_collider|ECBehaviorCollider]] | * [[behavior_collider|ECBehaviorCollider]] | ||
====== Optional Behaviors ====== | ====== Optional Behaviors ====== | ||
- | This behavior | + | * [[behavior_behaviortree|ECBehaviorBehaviorTree]]: |
+ | * [[behavior_statemachine|ECBehaviorStateMachine]]: | ||
====== Persistency ====== | ====== Persistency ====== | ||
Line 99: | Line 206: | ||
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 --> |