{{tag>dragonscript behavior}} [[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[abstractions#behavior_elementsquick_and_easy_development|Behavior Elements: Quick and Easy Development]] >> **ECBehaviorAlignActor** * [[behaviors_use_cases|Behaviors Explained: By Use-Case]] * [[behaviors_a_to_z|Behaviors Explained: From A to Z]] ====== ECBehaviorAlignActor ====== Behavior adding support to actors to align to a specific position and orientation. Manipulates [[behavior_locomotion|ECBehaviorLocomotion]] to move an actor a short distance to a specific position, orientation and looking direction. This is typically required for actors intending to interact with objects. In this case the animation of the actor has to match the object it is interacting with. Actor actions will use this behavior to achieve this goal. ====== Instance Counts ====== This behavior can be used only once on an element. ====== Element Class Properties ====== Element class properties have the prefix ''alignActor.'' . ===== speed ===== Set movement speed while aligning in meters per seconds. * Full name: ''alignActor.speed'' * Type: float * Default Value: 1.25 * Restriction: At least 0 * Example (*.deeclass) 2 ====== Events ====== This behavior has these events: ===== startAligning ===== Actor starts aligning. ===== finishedAligning ===== Actor finished aligning. ====== Required Behaviors ====== * [[behavior_locomotion|ECBehaviorLocomotion]] ====== Optional Behaviors ====== * [[behavior_conversationactor|ECBehaviorConversationActor]]: Restore aligning after leaving conversation. ====== Persistency ====== This behavior does support element class to be persistable (setPersistable). ====== API Documentation ====== #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ECBehaviorAlignActor.html,ECBehaviorAlignActor~@#. Since DragonScript Module Version ''1.0'' ====== Use Cases ====== * Align actor with specific position and orientation to interact with an element. * Ensure actor is aligned at the end of moving somewhere. ====== Element Class Example ====== This example defines an element which supports aligning actor. class MyElement extends BehaviorElementClass public var ECBehaviorComponent component public var ECBehaviorCollider collider public var ECBehaviorColliderAI colliderAI public var ECBehaviorLocomotion locomotion public var ECBehaviorConversationActor conversationActor public var ECBehaviorAlignActor alignActor func new() component = ECBehaviorComponent.new(this, null) collider = ECBehaviorCollider.new(this, component) colliderAI = ECBehaviorColliderAI.new(this, collider) locomotion = ECBehaviorLocomotion.new(this, colliderAI) conversationActor = ECBehaviorConversationActor.new(this) alignActor = ECBehaviorAlignActor.new(this, locomotion, conversationActor) end end ====== Behavior Factory ====== Using element class supporting adding behaviors the behavior can be added like this: 2 ====== Live Examples ====== * [[https://github.com/LordOfDragons/deexamples|DEExamples Repository]]