PhysicalBone3D
A physics body used to make bones in a Skeleton3D
react to physics.
class PhysicalBone3D
The PhysicalBone3D
node is a physics body that can be used to make bones in a Skeleton3D
react to physics.
Superclasses
class PhysicsBody3D
Abstract base class for 3D game objects affected by physics.
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 angularDamp: Double
Damps the body’s rotation. By default, the body will use the Default Angular Damp in Project > Project Settings > Physics > 3d or any value override set by an
Area3D
the body is in. Depending onangularDampMode
, you can setangularDamp
to be added to or to replace the body’s damping value.var angularDampMode: PhysicalBone3D.DampMode
Defines how
angularDamp
is applied. SeeDampMode
for possible values.var angularVelocity: Vector3
The PhysicalBone3D’s rotational velocity in radians per second.
var bodyOffset: Transform3D
Sets the body’s transform.
var bounce: Double
The body’s bounciness. Values range from
0
(no bounce) to1
(full bounciness).var canSleep: Bool
If
true
, the body is deactivated when there is no movement, so it will not take part in the simulation until it is awakened by an external force.var customIntegrator: Bool
If
true
, the standard force integration (like gravity or damping) will be disabled for this body. Other than collision response, the body will only move as determined by the_integrateForces(state:)
method, if that virtual method is overridden.var friction: Double
The body’s friction, from
0
(frictionless) to1
(max friction).var gravityScale: Double
This is multiplied by the global 3D gravity setting found in Project > Project Settings > Physics > 3d to produce the body’s gravity. For example, a value of 1 will be normal gravity, 2 will apply double gravity, and 0.5 will apply half gravity to this object.
var jointOffset: Transform3D
Sets the joint’s transform.
var jointRotation: Vector3
Sets the joint’s rotation in radians.
var jointType: PhysicalBone3D.JointType
Sets the joint type. See
JointType
for possible values.var linearDamp: Double
Damps the body’s movement. By default, the body will use the Default Linear Damp in Project > Project Settings > Physics > 3d or any value override set by an
Area3D
the body is in. Depending onlinearDampMode
, you can setlinearDamp
to be added to or to replace the body’s damping value.var linearDampMode: PhysicalBone3D.DampMode
Defines how
linearDamp
is applied. SeeDampMode
for possible values.var linearVelocity: Vector3
The body’s linear velocity in units per second. Can be used sporadically, but don’t set this every frame, because physics may run in another thread and runs at a different granularity. Use
_integrateForces(state:)
as your process loop for precise control of the body state.var mass: Double
The body’s mass.
func applyCentralImpulse(Vector3
) func applyImpulse(Vector3, position: Vector3
) func getBoneId(
) -> Int32 func getSimulatePhysics(
) -> Bool func isSimulatingPhysics(
) -> Bool
Show implementation details (1)
Hide implementation details
func _integrateForces(state: PhysicsDirectBodyState3D?
) Called during physics processing, allowing you to read and safely modify the simulation state for the object. By default, it is called before the standard force integration, but the
customIntegrator
property allows you to disable the standard force integration and do fully custom force integration for a body.