Start Page » DragonScript Scripting Language » Behavior Elements: Quick and Easy Development » ECBehaviorAvoidedByActor
Behavior adding support to elements to be avoided by actors.
Avoid shape is defined by position, half-size and radius. This allows to model spheres and round boxes as avoid shapes projected to the ground. The behavior can be enabled and disabled to allow define avoid shapes activate only at specific times. Although not prohibited shapes should not move to allow behaviors doing avoiding to work the best way possible.
This behavior can be added multiple times to add multiple avoid shapes. Use the behavior identifier to tell them apart.
Element class properties have the prefix avoidedByActor. or avoidedByActor({id}). if id is not empty.
Set origin relative to element.
<vector name='avoidedByActor.origin' x='0' y='0' z='0.3'>
Set size.
<vector2 name='avoidedByActor.size' x='0.6' y='0.4'/>
Set orientation along world Y axis relative to element world Y orientation.
<float name='avoidedByActor.orientation'>90</float>
Set radius.
<float name='avoidedByActor.radius'>0.4</float>
This behavior has no events.
This behavior requires no other behaviors.
This behavior does not support optional behaviors.
This behavior does not require persistency.
Since DragonScript Module Version 1.0
This example defines an element actors avoid. The avoid shape is a box shape with round corners.
class MyElement extends BehaviorElementClass public var ECBehaviorAvoidedByActor avoidedByActor public func new() avoidedByActor = ECBehaviorAvoidedByActor.new(this) avoidedByActor.getOrigin().setVector(Vector.new(0, 0, 0.3)) avoidedByActor.getSize().setVector2(Vector2.new(0.6, 0.3)) avoidedByActor.getRadius().setValue(0.3) end end
Using element class supporting adding behaviors the behavior can be added like this:
<?xml version='1.0' encoding='UTF-8'?> <elementClass name='MyClass' class='GenericBehaviorElement'> <behavior type='ECBehaviorAvoidedByActor'/> </elementClass>