WorldBoundaryShape2D
A 2D world boundary (half-plane) shape used for physics collision.
WorldBoundaryShape2D.swift:11class WorldBoundaryShape2D
A 2D world boundary shape, intended for use in physics. WorldBoundaryShape2D
works like an infinite straight line that forces all physics bodies to stay above it. The line’s normal determines which direction is considered as “above” and in the editor, the smaller line over it represents this direction. It can for example be used for endless flat floors.
Superclasses
class Shape2D
Abstract base class for 2D shapes used for physics collision.
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 exampleGString
,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 distance: Double
The distance from the origin to the line, expressed in terms of
normal
(according to its direction and magnitude). Actual absolute distance from the origin to the line can be calculated asabs(distance) / normal.length()
.var normal: Vector2
The line’s normal, typically a unit vector. Its direction indicates the non-colliding half-plane. Can be of any length but zero. Defaults to
Vector2.UP
.