{{tag>dragonscript behavior}} [[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[abstractions#behavior_elementsquick_and_easy_development|Behavior Elements: Quick and Easy Development]] >> **ECBehaviorNavigationBlocker** * [[behaviors_use_cases|Behaviors Explained: By Use-Case]] * [[behaviors_a_to_z|Behaviors Explained: From A to Z]] ====== 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 [[behavior_navigator|ECBehaviorNavigator]] to interact with ECBehaviorNavigationBlocker. If the [[behavior_collider|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: * [[gamedev:navigation|Navigation System]] * [[tools:blenderexportscripts|Blender3D Export Scripts]] ====== 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. * Full name: ''navigationBlocker.layer'' or ''navigationBlocker({id}).layer'' * Type: integer * Default Value: 0 * Example (*.deeclass) 1 ===== shape ===== Set blocker shape. Carves space inside shape out of touching navigation spaces. * Full name: ''navigationBlocker.shape'' or ''navigationBlocker({id}).shape'' * Type: string (shape format). See "Shape List Encoding" in CodecPropertyString. * Default Value: empty string * Example (*.deeclass) box:position,0,0.5,0:extends,2,1,0.5 ===== priority ===== Set priority. Blockers only carve space out of navigation spaces with the same priority or lower as the blocker priority. * Full name: ''navigationBlocker.priority'' or ''navigationBlocker({id}).priority'' * Type: integer * Default Value: 0 * Example (*.deeclass) 1 ===== position ===== Set position to attach resource to collider. * Full name: ''navigationBlocker.position'' or ''navigationBlocker({id}).position'' * Type: 3-component float vector * Default Value: (0,0,0) * Example (*.deeclass) ===== orientation ===== Set orientation to attach resource to collider in degrees. * Full name: ''navigationBlocker.orientation'' or ''navigationBlocker({id}).orientation'' * Type: 3-component float vector * Default Value: (0,0,0) * Example (*.deeclass) ===== bone ===== Set bone to attach resource to. If empty string attach to collider. * Full name: ''navigationBlocker.bone'' or ''navigationBlocker({id}).bone'' * Type: string * Default Value: empty string * Example (*.deeclass) attach ====== Events ====== This behavior has no events. ====== Required Behaviors ====== This behavior requires no other behaviors. ====== Optional Behaviors ====== * [[behavior_collider|ECBehaviorCollider]]: Attach to collider. ====== Persistency ====== This behavior does not require the element class to be persistable (setPersistable). ====== API Documentation ====== #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ECBehaviorNavigationBlocker.html,ECBehaviorNavigationBlocker~@#. Since DragonScript Module Version ''1.0'' ====== Use Cases ====== * Prevent navigators moving across space covered by blocker shape. ====== 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: box:position,0,0.5,0:extends,2,1,0.5 ====== Live Examples ====== * [[https://github.com/LordOfDragons/deexamples|DEExamples Repository]]