GLTFPhysicsBody
Represents a GLTF physics body.
GLTFPhysicsBody.swift:11class GLTFPhysicsBody
Represents a physics body as defined by the OMI_physics_body
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
) -> GLTFPhysicsBody? Creates a new GLTFPhysicsBody instance by parsing the given
GDictionary
.static func fromNode(bodyNode: CollisionObject3D?
) -> GLTFPhysicsBody? Create a new GLTFPhysicsBody instance from the given Godot
CollisionObject3D
node.class var godotClassName: StringName
Instance members
var angularVelocity: Vector3
The angular velocity of the physics body, in radians per second. This is only used when the body type is “rigid” or “vehicle”.
var bodyType: String
The type of the body. When importing, this controls what type of
CollisionObject3D
node Godot should generate. Valid values are “static”, “kinematic”, “character”, “rigid”, “vehicle”, and “trigger”.var centerOfMass: Vector3
The center of mass of the body, in meters. This is in local space relative to the body. By default, the center of the mass is the body’s origin.
var inertiaTensor: Basis
The inertia tensor of the physics body, in kilogram meter squared (kg⋅m²). This is only used when the body type is “rigid” or “vehicle”.
var linearVelocity: Vector3
The linear velocity of the physics body, in meters per second. This is only used when the body type is “rigid” or “vehicle”.
var mass: Double
The mass of the physics body, in kilograms. This is only used when the body type is “rigid” or “vehicle”.
func toDictionary(
) -> GDictionary Serializes this GLTFPhysicsBody instance into a
GDictionary
.func toNode(
) -> CollisionObject3D? Converts this GLTFPhysicsBody instance into a Godot
CollisionObject3D
node.