Start Page » DragonScript Scripting Language » Behavior Elements: Quick and Easy Development » 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:
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 have the prefix navigationBlocker.
or navigationBlocker({id}).
if id is not empty.
Set layer. Only spaces, blockers and navigators on the same layer affect each other.
navigationBlocker.layer
or navigationBlocker({id}).layer
<integer name='navigationBlocker.layer'>1</integer>
Set blocker shape. Carves space inside shape out of touching navigation spaces.
navigationBlocker.shape
or navigationBlocker({id}).shape
<string name='navigationBlocker.shape'>box:position,0,0.5,0:extends,2,1,0.5</string>
Set priority. Blockers only carve space out of navigation spaces with the same priority or lower as the blocker priority.
navigationBlocker.priority
or navigationBlocker({id}).priority
<integer name='navigationBlocker.priority'>1</integer>
Set position to attach resource to collider.
navigationBlocker.position
or navigationBlocker({id}).position
<vector name='navigationBlocker.position' x='0' y='0' z='0.1'/>
Set orientation to attach resource to collider in degrees.
navigationBlocker.orientation
or navigationBlocker({id}).orientation
<vector name='navigationBlocker.orientation' x='30' y='0' z='0'/>
Set bone to attach resource to. If empty string attach to collider.
navigationBlocker.bone
or navigationBlocker({id}).bone
<string name='navigationBlocker.bone'>attach</string>
This behavior has no events.
This behavior requires no other behaviors.
This behavior does not require the element class to be persistable (setPersistable).
Since DragonScript Module Version 1.0
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
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>