Table of Contents

,

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

ECBehaviorNavigationBlocker

Behavior element behavior adding navigation blocker support.

Behavior adds a NavigationBlocker resource to the the behavior element. This allow elements using Navigator resource to avoid moving into the blocked space. Actors have a navigator by default. Other elements can use ECBehaviorNavigator to interact with ECBehaviorNavigationBlocker.

If the ECBehaviorCollider behavior is present in the behavior element before this behavior is added the light is attached. The light is attached to the named bone if defined otherwise it is attached statically.

See also:

Instance Counts

This behavior can be added multiple times to an element. Each instance creates one navigation blocker attached to the element collider which can be individually modified. Use the behavior identifier to tell them apart.

Element Class Properties

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

layer

Set layer. Only spaces, blockers and navigators on the same layer affect each other.

shape

Set blocker shape. Carves space inside shape out of touching navigation spaces.

priority

Set priority. Blockers only carve space out of navigation spaces with the same priority or lower as the blocker priority.

position

Set position to attach resource to collider.

orientation

Set orientation to attach resource to collider in degrees.

bone

Set bone to attach resource to. If empty string attach to collider.

Events

This behavior has no events.

Required Behaviors

This behavior requires no other behaviors.

Optional Behaviors

Persistency

This behavior does not require the element class to be persistable (setPersistable).

API Documentation

ECBehaviorNavigationBlocker.

Since DragonScript Module Version 1.0

Use Cases

Element Class Example

This example defines an element which contains a navigation blocker.

class MyElement extends BehaviorElementClass
  public var ECBehaviorComponent component
  public var ECBehaviorCollider collider
  public var ECBehaviorNavigationBlocker navigationBlocker
  func new()
    component = ECBehaviorComponent.new(this, null)
    collider = ECBehaviorCollider.new(this, component)
    navigationBlocker = ECBehaviorNavigationBlocker.new(this, collider)
    
    var ShapeList shape = ShapeList.new()
    shape.addBox(Vector.new(), Vector.new(0.6, 0.3, 0.3))
    navigationBlocker.getNavigationBlocker().getShape().setShape(shape)
  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='ECBehaviorComponent'/>
  <behavior type='ECBehaviorCollider'/>
 
  <behavior type='ECBehaviorNavigationBlocker'>
    <!-- set element properties. omit property prefix if used inside behavior tag -->
    <string name='.shape'>box:position,0,0.5,0:extends,2,1,0.5</string>
  </behavior>
 
  <!-- for adding multiple behaviors use unique identifiers -->
  <behavior type='ECBehaviorNavigationBlocker' id='second'/>
</elementClass>

Live Examples