CollisionPolygon2D
A node that provides a polygon shape to a CollisionObject2D
parent.
class CollisionPolygon2D
A node that provides a thickened polygon shape (a prism) to a CollisionObject2D
parent and allows to edit it. The polygon can be concave or convex. This can give a detection shape to an Area2D
or turn PhysicsBody2D
into a solid object.
Superclasses
class Node2D
A 2D game object, inherited by all 2D-related nodes. Has a position, rotation, scale, and Z index.
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.
Types
Type members
Instance members
var buildMode: CollisionPolygon2D.BuildMode
Collision build mode. Use one of the
BuildMode
constants.var disabled: Bool
If
true
, no collisions will be detected.var oneWayCollision: Bool
If
true
, only edges that face up, relative toCollisionPolygon2D
’s rotation, will collide with other objects.var oneWayCollisionMargin: Double
The margin used for one-way collision (in pixels). Higher values will make the shape thicker, and work better for colliders that enter the polygon at a high velocity.
var polygon: PackedVector2Array
The polygon’s list of vertices. Each point will be connected to the next, and the final point will be connected to the first.