ConvexPolygonShape3D
A 3D convex polyhedron shape used for physics collision.
ConvexPolygonShape3D.swift:24class ConvexPolygonShape3D
A 3D convex polyhedron shape, intended for use in physics. Usually used to provide a shape for a CollisionShape3D
.
ConvexPolygonShape3D
is solid, which means it detects collisions from objects that are fully inside it, unlike ConcavePolygonShape3D
which is hollow. This makes it more suitable for both detection and physics.
Convex decomposition: A concave polyhedron can be split up into several convex polyhedra. This allows dynamic physics bodies to have complex concave collisions (at a performance cost) and can be achieved by using several ConvexPolygonShape3D
nodes. To generate a convex decomposition from a mesh, select the MeshInstance3D
node, go to the Mesh menu that appears above the viewport, and choose Create Multiple Convex Collision Siblings. Alternatively, createMultipleConvexCollisions(settings:)
can be called in a script to perform this decomposition at run-time.
Performance: ConvexPolygonShape3D
is faster to check collisions against compared to ConcavePolygonShape3D
, but it is slower than primitive collision shapes such as SphereShape3D
and BoxShape3D
. Its use should generally be limited to medium-sized objects that cannot have their collision accurately represented by primitive shapes.
Superclasses
class Shape3D
Abstract base class for 3D 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 points: PackedVector3Array
The list of 3D points forming the convex polygon shape.