Documentation
¶
Overview ¶
The PhysicalBone3D node is a physics body that can be used to make bones in a Skeleton3D react to physics.
Note: In order to detect physical bones with raycasts, the SkeletonModifier3D.Active property of the parent PhysicalBoneSimulator3D must be true and the Skeleton3D's bone must be assigned to PhysicalBone3D correctly; it means that GetBoneId should return a valid id (>= 0).
Index ¶
- type Advanced
- type Any
- type DampMode
- type Expanded
- type Extension
- func (self *Extension[T]) AsCollisionObject3D() CollisionObject3D.Instance
- func (self *Extension[T]) AsNode() Node.Instance
- func (self *Extension[T]) AsNode3D() Node3D.Instance
- func (self *Extension[T]) AsObject() [1]gd.Object
- func (self *Extension[T]) AsPhysicalBone3D() Instance
- func (self *Extension[T]) AsPhysicsBody3D() PhysicsBody3D.Instance
- type ID
- type Implementation
- type Instance
- func (self Instance) AngularDamp() Float.X
- func (self Instance) AngularDampMode() DampMode
- func (self Instance) AngularVelocity() Vector3.XYZ
- func (self Instance) ApplyCentralImpulse(impulse Vector3.XYZ)
- func (self Instance) ApplyImpulse(impulse Vector3.XYZ)
- func (self Instance) AsCollisionObject3D() CollisionObject3D.Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsNode3D() Node3D.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsPhysicalBone3D() Instance
- func (self Instance) AsPhysicsBody3D() PhysicsBody3D.Instance
- func (self Instance) BodyOffset() Transform3D.BasisOrigin
- func (self Instance) Bounce() Float.X
- func (self Instance) CanSleep() bool
- func (self Instance) CustomIntegrator() bool
- func (self Instance) Friction() Float.X
- func (self Instance) GetBoneId() int
- func (self Instance) GetSimulatePhysics() bool
- func (self Instance) GravityScale() Float.X
- func (self Instance) ID() ID
- func (self Instance) IsSimulatingPhysics() bool
- func (self Instance) JointOffset() Transform3D.BasisOrigin
- func (self Instance) JointRotation() Vector3.XYZ
- func (self Instance) JointType() JointType
- func (self Instance) LinearDamp() Float.X
- func (self Instance) LinearDampMode() DampMode
- func (self Instance) LinearVelocity() Vector3.XYZ
- func (self Instance) Mass() Float.X
- func (self Instance) MoreArgs() MoreArgs
- func (self Instance) SetAngularDamp(value Float.X)
- func (self Instance) SetAngularDampMode(value DampMode)
- func (self Instance) SetAngularVelocity(value Vector3.XYZ)
- func (self Instance) SetBodyOffset(value Transform3D.BasisOrigin)
- func (self Instance) SetBounce(value Float.X)
- func (self Instance) SetCanSleep(value bool)
- func (self Instance) SetCustomIntegrator(value bool)
- func (self Instance) SetFriction(value Float.X)
- func (self Instance) SetGravityScale(value Float.X)
- func (self Instance) SetJointOffset(value Transform3D.BasisOrigin)
- func (self Instance) SetJointRotation(value Vector3.XYZ)
- func (self Instance) SetJointType(value JointType)
- func (self Instance) SetLinearDamp(value Float.X)
- func (self Instance) SetLinearDampMode(value DampMode)
- func (self Instance) SetLinearVelocity(value Vector3.XYZ)
- func (self Instance) SetMass(value Float.X)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) Virtual(name string) reflect.Value
- type Interface
- type JointType
- type MoreArgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this [Extension]See Interface for methods that can be overridden by T.
func (*Extension[T]) AsCollisionObject3D ¶
func (self *Extension[T]) AsCollisionObject3D() CollisionObject3D.Instance
func (*Extension[T]) AsPhysicalBone3D ¶
func (*Extension[T]) AsPhysicsBody3D ¶
func (self *Extension[T]) AsPhysicsBody3D() PhysicsBody3D.Instance
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Implementation ¶
type Implementation = implementation
Implementation implements Interface with empty methods.
type Instance ¶
type Instance [1]gdclass.PhysicalBone3D
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AngularDamp ¶
Damps the body's rotation. By default, the body will use the ProjectSettings "physics/3d/default_angular_damp" project setting or any value override set by an Area3D the body is in. Depending on AngularDampMode, you can set AngularDamp to be added to or to replace the body's damping value.
See ProjectSettings "physics/3d/default_angular_damp" for more details about damping.
func (Instance) AngularDampMode ¶
Defines how AngularDamp is applied.
func (Instance) AngularVelocity ¶
The PhysicalBone3D's rotational velocity in radians per second.
func (Instance) ApplyCentralImpulse ¶
Applies a directional impulse without affecting rotation.
An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_integrate_forces" functions otherwise).
This is equivalent to using ApplyImpulse at the body's center of mass.
func (Instance) ApplyImpulse ¶
Applies a positioned impulse to the PhysicsBone3D.
An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_integrate_forces" functions otherwise).
'position' is the offset from the PhysicsBone3D origin in global coordinates.
func (Instance) AsCollisionObject3D ¶
func (self Instance) AsCollisionObject3D() CollisionObject3D.Instance
func (Instance) AsPhysicalBone3D ¶
func (Instance) AsPhysicsBody3D ¶
func (self Instance) AsPhysicsBody3D() PhysicsBody3D.Instance
func (Instance) BodyOffset ¶
func (self Instance) BodyOffset() Transform3D.BasisOrigin
Sets the body's transform.
func (Instance) Bounce ¶
The body's bounciness. Values range from 0 (no bounce) to 1 (full bounciness).
Note: Even with Bounce set to 1.0, some energy will be lost over time due to linear and angular damping. To have a PhysicalBone3D that preserves all its energy over time, set Bounce to 1.0, LinearDampMode to DampModeReplace, LinearDamp to 0.0, AngularDampMode to DampModeReplace, and AngularDamp to 0.0.
func (Instance) CanSleep ¶
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.
func (Instance) CustomIntegrator ¶
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 method, if that virtual method is overridden.
Setting this property will call the method PhysicsServer3D.BodySetOmitForceIntegration internally.
func (Instance) GetSimulatePhysics ¶
Returns true if the PhysicsBone3D is allowed to simulate physics.
func (Instance) GravityScale ¶
This is multiplied by ProjectSettings "physics/3d/default_gravity" to produce this body's gravity. For example, a value of 1.0 will apply normal gravity, 2.0 will apply double the gravity, and 0.5 will apply half the gravity to this body.
func (Instance) IsSimulatingPhysics ¶
Returns true if the PhysicsBone3D is currently simulating physics.
func (Instance) JointOffset ¶
func (self Instance) JointOffset() Transform3D.BasisOrigin
Sets the joint's transform.
func (Instance) JointRotation ¶
Sets the joint's rotation in radians.
func (Instance) LinearDamp ¶
Damps the body's movement. By default, the body will use ProjectSettings "physics/3d/default_linear_damp" or any value override set by an Area3D the body is in. Depending on LinearDampMode, LinearDamp may be added to or replace the body's damping value.
See ProjectSettings "physics/3d/default_linear_damp" for more details about damping.
func (Instance) LinearDampMode ¶
Defines how LinearDamp is applied.
func (Instance) LinearVelocity ¶
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 as your process loop for precise control of the body state.
func (Instance) MoreArgs ¶
MoreArgs enables certain functions to be called with additional 'optional' arguments.
func (Instance) SetAngularDamp ¶
SetAngularDamp sets the property returned by [GetAngularDamp].
func (Instance) SetAngularDampMode ¶
SetAngularDampMode sets the property returned by [GetAngularDampMode].
func (Instance) SetAngularVelocity ¶
SetAngularVelocity sets the property returned by [GetAngularVelocity].
func (Instance) SetBodyOffset ¶
func (self Instance) SetBodyOffset(value Transform3D.BasisOrigin)
SetBodyOffset sets the property returned by [GetBodyOffset].
func (Instance) SetCanSleep ¶
SetCanSleep sets the property returned by [IsAbleToSleep].
func (Instance) SetCustomIntegrator ¶
SetCustomIntegrator sets the property returned by [IsUsingCustomIntegrator].
func (Instance) SetFriction ¶
SetFriction sets the property returned by [GetFriction].
func (Instance) SetGravityScale ¶
SetGravityScale sets the property returned by [GetGravityScale].
func (Instance) SetJointOffset ¶
func (self Instance) SetJointOffset(value Transform3D.BasisOrigin)
SetJointOffset sets the property returned by [GetJointOffset].
func (Instance) SetJointRotation ¶
SetJointRotation sets the property returned by [GetJointRotation].
func (Instance) SetJointType ¶
SetJointType sets the property returned by [GetJointType].
func (Instance) SetLinearDamp ¶
SetLinearDamp sets the property returned by [GetLinearDamp].
func (Instance) SetLinearDampMode ¶
SetLinearDampMode sets the property returned by [GetLinearDampMode].
func (Instance) SetLinearVelocity ¶
SetLinearVelocity sets the property returned by [GetLinearVelocity].
type Interface ¶
type Interface interface { // 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. // // [CustomIntegrator]: https://pkg.go.dev/graphics.gd/classdb/PhysicalBone3D#Instance.CustomIntegrator IntegrateForces(state PhysicsDirectBodyState3D.Instance) }
type JointType ¶
type JointType int //gd:PhysicalBone3D.JointType
const ( // No joint is applied to the PhysicsBone3D. JointTypeNone JointType = 0 // A pin joint is applied to the PhysicsBone3D. JointTypePin JointType = 1 // A cone joint is applied to the PhysicsBone3D. JointTypeCone JointType = 2 // A hinge joint is applied to the PhysicsBone3D. JointTypeHinge JointType = 3 // A slider joint is applied to the PhysicsBone3D. JointTypeSlider JointType = 4 // A 6 degrees of freedom joint is applied to the PhysicsBone3D. JointType6dof JointType = 5 )
type MoreArgs ¶
type MoreArgs [1]gdclass.PhysicalBone3D
MoreArgs is a container for Instance functions with additional 'optional' arguments.
func (MoreArgs) ApplyImpulse ¶
Applies a positioned impulse to the PhysicsBone3D.
An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_integrate_forces" functions otherwise).
'position' is the offset from the PhysicsBone3D origin in global coordinates.