This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
dragengine:modules:dragonscript:behavior_animated [2025/03/12 14:43] – [ECBehaviorAnimated] dragonlord | dragengine:modules:dragonscript:behavior_animated [2025/03/13 17:10] (current) – dragonlord | ||
---|---|---|---|
Line 1: | Line 1: | ||
{{tag> | {{tag> | ||
<WRAP youarehere> | <WRAP youarehere> | ||
- | [[: | + | [[: |
</ | </ | ||
Line 14: | Line 14: | ||
To use this behavior make sure to add first the [[behavior_component|ECBehaviorComponent]] to animate. | To use this behavior make sure to add first the [[behavior_component|ECBehaviorComponent]] to animate. | ||
- | |||
- | Because multiple animator behaviors can animate the same component behavior the animator behavior has an own identifier. In the example above the first string parameter is the animator behavior identifier while the second string parameter is the component behavior identifier to animate. | ||
See also: | See also: | ||
Line 110: | Line 108: | ||
A typical usage pattern for such behaviors is to locate the animator controller to update during construction time and to manipulated the controllers inside updateControllers(). | A typical usage pattern for such behaviors is to locate the animator controller to update during construction time and to manipulated the controllers inside updateControllers(). | ||
+ | |||
See [[# | See [[# | ||
Line 132: | Line 131: | ||
====== Required Behaviors ====== | ====== Required Behaviors ====== | ||
- | This behavior requires these other behaviors: | ||
* [[behavior_component|ECBehaviorComponent]] | * [[behavior_component|ECBehaviorComponent]] | ||
Line 165: | Line 163: | ||
component = ECBehaviorComponent.new(this, | component = ECBehaviorComponent.new(this, | ||
animated = ECBehaviorAnimated.new(this, | animated = ECBehaviorAnimated.new(this, | ||
+ | end | ||
+ | end | ||
+ | </ | ||
+ | |||
+ | Example of using listeners. | ||
+ | |||
+ | < | ||
+ | class MyListener extends ECBehaviorInstance.DefaultListener | ||
+ | var AnimatorController pController | ||
+ | | ||
+ | func new(ECBehaviorAnimated behavior) | ||
+ | pController = behavior.getAnimatorInstance().getControllerNamed(" | ||
+ | end | ||
+ | | ||
+ | func void updateControllers(Instance instance, float elapsed) | ||
+ | pController.increment(elapsed) | ||
end | end | ||
end | end |