NavigationObstacle3D

    3D obstacle used to affect navigation mesh baking or constrain velocities of avoidance controlled agents.

    NavigationObstacle3D.swift:22
    class NavigationObstacle3D

    An obstacle needs a navigation map and outline vertices defined to work correctly. The outlines can not cross or overlap and are restricted to a plane projection. This means the y-axis of the vertices is ignored, instead the obstacle’s global y-axis position is used for placement. The projected shape is extruded by the obstacles height along the y-axis.

    Obstacles can be included in the navigation mesh baking process when affectNavigationMesh is enabled. They do not add walkable geometry, instead their role is to discard other source geometry inside the shape. This can be used to prevent navigation mesh from appearing in unwanted places, e.g. inside “solid” geometry or on top of it. If carveNavigationMesh is enabled the baked shape will not be affected by offsets of the navigation mesh baking, e.g. the agent radius.

    With avoidanceEnabled the obstacle can constrain the avoidance velocities of avoidance using agents. If the obstacle’s vertices are wound in clockwise order, avoidance agents will be pushed in by the obstacle, otherwise, avoidance agents will be pushed out. Obstacles using vertices and avoidance can warp to a new position but should not be moved every single frame as each change requires a rebuild of the avoidance map.

    Superclasses

    • class Node3D

      Most basic 3D game object, parent of all 3D-related nodes.

    Citizens in SwiftGodot

    Conformances

    • protocol CustomStringConvertible

      A type with a customized textual representation.

    • protocol Equatable

      A type that can be compared for value equality.

    • protocol Hashable

      A type that can be hashed into a Hasher to produce an integer hash value.

    • protocol Identifiable<ID>

      A class of types whose instances hold the value of an entity with stable identity.

    • protocol VariantRepresentable

      Types that conform to VariantRepresentable can be stored directly in Variant with no conversion. These include all of the Variant types from Godot (for example GString, Rect, Plane), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.

    • protocol VariantStorable

      Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.

    Type members

    Instance members

    • var affectNavigationMesh: Bool

      If enabled and parsed in a navigation mesh baking process the obstacle will discard source geometry inside its vertices and height defined shape.

    • var avoidanceEnabled: Bool

      If true the obstacle affects avoidance using agents.

    • var avoidanceLayers: UInt32

      A bitfield determining the avoidance layers for this obstacle. Agents with a matching bit on the their avoidance mask will avoid this obstacle.

    • var carveNavigationMesh: Bool

      If enabled the obstacle vertices will carve into the baked navigation mesh with the shape unaffected by additional offsets (e.g. agent radius).

    • var height: Double

      Sets the obstacle height used in 2D avoidance. 2D avoidance using agent’s ignore obstacles that are below or above them.

    • var radius: Double

      Sets the avoidance radius for the obstacle.

    • var use3dAvoidance: Bool

      If true the obstacle affects 3D avoidance using agent’s with obstacle radius.

    • var velocity: Vector3

      Sets the wanted velocity for the obstacle so other agent’s can better predict the obstacle if it is moved with a velocity regularly (every frame) instead of warped to a new position. Does only affect avoidance for the obstacles radius. Does nothing for the obstacles static vertices.

    • var vertices: PackedVector3Array

      The outline vertices of the obstacle. If the vertices are winded in clockwise order agents will be pushed in by the obstacle, else they will be pushed out. Outlines can not be crossed or overlap. Should the vertices using obstacle be warped to a new position agent’s can not predict this movement and may get trapped inside the obstacle.

    • func getAvoidanceLayerValue(layerNumber: Int32) -> Bool

      Returns whether or not the specified layer of the avoidanceLayers bitmask is enabled, given a layerNumber between 1 and 32.

    • func getNavigationMap() -> RID

      Returns the RID of the navigation map for this NavigationObstacle node. This function returns always the map set on the NavigationObstacle node and not the map of the abstract obstacle on the NavigationServer. If the obstacle map is changed directly with the NavigationServer API the NavigationObstacle node will not be aware of the map change. Use setNavigationMap(_:) to change the navigation map for the NavigationObstacle and also update the obstacle on the NavigationServer.

    • func getRid() -> RID

      Returns the RID of this obstacle on the NavigationServer3D.

    • func setAvoidanceLayerValue(layerNumber: Int32, value: Bool)

      Based on value, enables or disables the specified layer in the avoidanceLayers bitmask, given a layerNumber between 1 and 32.

    • func setNavigationMap(RID)

      Sets the RID of the navigation map this NavigationObstacle node should use and also updates the obstacle on the NavigationServer.