Table of Contents

,

Start Page » DragonScript Scripting Language » Behavior Elements: Quick and Easy Development » ECBehaviorAvoidedByActor

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.

Instance Counts

This behavior can be added multiple times to add multiple avoid shapes. Use the behavior identifier to tell them apart.

Element Class Properties

Element class properties have the prefix avoidedByActor. or avoidedByActor({id}). if id is not empty.

origin

Set origin relative to element.

size

Set size.

orientation

Set orientation along world Y axis relative to element world Y orientation.

radius

Set radius.

Events

This behavior has no events.

Required Behaviors

This behavior requires no other behaviors.

Optional Behaviors

This behavior does not support optional behaviors.

Persistency

This behavior does not require persistency.

API Documentation

ECBehaviorAvoidedByActor.

Since DragonScript Module Version 1.0

Use Cases

Element Class Example

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

Behavior Factory

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>

Live Examples