GLTFPhysicsShape
Represents a GLTF physics shape.
GLTFPhysicsShape.swift:11class GLTFPhysicsShape
Represents a physics shape as defined by the OMI_collider
GLTF extension. This class is an intermediary between the GLTF data and Godot’s nodes, and it’s abstracted in a way that allows adding support for different GLTF physics extensions in the future.
Superclasses
class Resource
Base class for serializable objects.
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
static func fromDictionary(GDictionary
) -> GLTFPhysicsShape? Creates a new GLTFPhysicsShape instance by parsing the given
GDictionary
.static func fromNode(shapeNode: CollisionShape3D?
) -> GLTFPhysicsShape? Create a new GLTFPhysicsShape instance from the given Godot
CollisionShape3D
node.class var godotClassName: StringName
Instance members
var height: Double
The height of the shape, in meters. This is only used when the shape type is “capsule” or “cylinder”. This value should not be negative, and for “capsule” it should be at least twice the radius.
var importerMesh: ImporterMesh?
The
ImporterMesh
resource of the shape. This is only used when the shape type is “hull” (convex hull) or “trimesh” (concave trimesh).var isTrigger: Bool
If
true
, indicates that this shape is a trigger. For Godot, this means that the shape should be a child of an Area3D node.var meshIndex: Int32
The index of the shape’s mesh in the GLTF file. This is only used when the shape type is “hull” (convex hull) or “trimesh” (concave trimesh).
var radius: Double
The radius of the shape, in meters. This is only used when the shape type is “capsule”, “cylinder”, or “sphere”. This value should not be negative.
var shapeType: String
The type of shape this shape represents. Valid values are “box”, “capsule”, “cylinder”, “sphere”, “hull”, and “trimesh”.
var size: Vector3
The size of the shape, in meters. This is only used when the shape type is “box”, and it represents the “diameter” of the box. This value should not be negative.
func toDictionary(
) -> GDictionary Serializes this GLTFPhysicsShape instance into a
GDictionary
.func toNode(cacheShapes: Bool
) -> CollisionShape3D? Converts this GLTFPhysicsShape instance into a Godot
CollisionShape3D
node.