{{tag>dragonscript behavior}} [[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[dragengine:modules:dragonscript:abstractions|Abstraction Layers: How you want to build your Game]] >> [[dragengine:modules:dragonscript:behavior_elements|Behavior Elements]] >> **ECBehaviorNavigationSpace** * [[behaviors_use_cases|Behaviors Explained: By Use-Case]] * [[behaviors_a_to_z|Behaviors Explained: From A to Z]] ====== ECBehaviorNavigationSpace ====== Behavior element behavior adding navigation space and blocker support. Behavior adds a NavigationSpace resource to the the behavior element. This allow elements using Navigator resource to move around the element. Actors have a navigator by default. Other elements can use ECBehaviorNavigator to interact with ECBehaviorNavigationSpace. 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 space attached to the element collider which can be individually modified ====== Element Class Properties ====== Element class properties have the prefix ''navigationSpace.'' or ''navigationSpace({id}).'' if id is not empty. ===== layer ===== Set layer. Only spaces, blockers and navigators on the same layer affect each other. * Full name: ''navigationSpace.layer'' or ''navigationSpace({id}).layer'' * Type: integer * Default Value: 0 * Example (*.deeclass) 1 ===== path ===== Set path to navigation space resource to use. * Full name: ''navigationSpace.path'' or ''navigationSpace({id}).path'' * Type: string * Default Value: empty string * Expected File Pattern: ''*.denavspace'' * Example (*.deeclass) room.denavspace ===== snapDistance ===== Set snap distance. If two navigation spaces nearly touch or overlap each other navigation points are aligned if they are closer than the snap distance. This does potentially modify points on navigation spaces but it ensures two separate navigation spaces turn into one large navigation space. * Full name: ''navigationSpace.snapDistance'' or ''navigationSpace({id}).snapDistance'' * Type: float * Default Value: 0.001 * Restriction: At least 0.001 * Example (*.deeclass) 0.01 ===== blockerShape ===== Set blocker shape. Carves space inside shape out of touching navigation spaces. After carving out space the navigation space is merged with the other navigation spaces. This allows for example to add a passage way across navigation spaces by first carving out the stairs area and then merging the passage way navigation space with the underlaying navigation space. If done correctly placing such an element in the world makes navigators be automatically able to use the passage way properly. * Full name: ''navigationSpace.blockerShape'' or ''navigationSpace({id}).blockerShape'' * 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 ===== blockerPriority ===== Set blocker priority. Blockers only carve space out of navigation spaces with the same priority or lower as the blocker priority. * Full name: ''navigationSpace.blockerPriority'' or ''navigationSpace({id}).blockerPriority'' * Type: integer * Default Value: 0 * Example (*.deeclass) 1 ===== position ===== Set position to attach resource to collider. * Full name: ''navigationSpace.position'' or ''navigationSpace({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: ''navigationSpace.orientation'' or ''navigationSpace({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: ''navigationSpace.bone'' or ''navigationSpace({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 require the element class to be persistable (setPersistable). ====== API Documentation ====== #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ECBehaviorNavigationSpace.html,ECBehaviorNavigationSpace~@#. Since DragonScript Module Version ''1.0'' ====== Use Cases ====== * Add spaces navgiators can move along. * Add spaces connecting spaces by carving out first a blocker shape then merging for dynamic passages. ====== Element Class Example ====== This example defines an element which contains a navigation space. class MyElement extends BehaviorElementClass public var ECBehaviorComponent component public var ECBehaviorCollider collider public var ECBehaviorNavigationSpace navigationSpace func new() component = ECBehaviorComponent.new(this, null) collider = ECBehaviorCollider.new(this, component) navigationSpace = ECBehaviorNavigationSpace.new(this, collider) navigationSpace.getNavigationSpace().getSpace().setPath("/content/navigation/floor.denavspace") end end ====== Behavior Factory ====== Using element class supporting adding behaviors the behavior can be added like this: floor.denavspace ====== Live Examples ====== * [[https://github.com/LordOfDragons/deexamples|DEExamples Repository]]