Documentation
¶
Overview ¶
This graphics.gd/classdb/SkeletonModifier3D can be used to wiggle hair, cloth, and tails. This modifier behaves differently from graphics.gd/classdb/PhysicalBoneSimulator3D as it attempts to return the original pose after modification.
If you setup Instance.SetRootBone and Instance.SetEndBone, it is treated as one bone chain. Note that it does not support a branched chain like Y-shaped chains.
When a bone chain is created, an array is generated from the bones that exist in between and listed in the joint list.
Several properties can be applied to each joint, such as Instance.SetJointStiffness, Instance.SetJointDrag, and Instance.SetJointGravity.
For simplicity, you can set values to all joints at the same time by using a graphics.gd/classdb/Curve. If you want to specify detailed values individually, set Instance.SetIndividualConfig to true.
For physical simulation, graphics.gd/classdb/SpringBoneSimulator3D can have children as self-standing collisions that are not related to graphics.gd/classdb/PhysicsServer3D, see also graphics.gd/classdb/SpringBoneCollision3D.
Warning: A scaled graphics.gd/classdb/SpringBoneSimulator3D will likely not behave as expected. Make sure that the parent graphics.gd/classdb/Skeleton3D and its bones are not scaled.
Index ¶
- type Advanced
- type Any
- type BoneDirection
- type CenterFrom
- type Extension
- type ID
- type Instance
- func (self Instance) AreAllChildCollisionsEnabled(index int) bool
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsNode3D() Node3D.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsSkeletonModifier3D() SkeletonModifier3D.Instance
- func (self Instance) AsSpringBoneSimulator3D() Instance
- func (self Instance) ClearCollisions(index int)
- func (self Instance) ClearExcludeCollisions(index int)
- func (self Instance) ClearSettings()
- func (self Instance) ExternalForce() Vector3.XYZ
- func (self Instance) GetCenterBone(index int) int
- func (self Instance) GetCenterBoneName(index int) string
- func (self Instance) GetCenterFrom(index int) CenterFrom
- func (self Instance) GetCenterNode(index int) string
- func (self Instance) GetCollisionCount(index int) int
- func (self Instance) GetCollisionPath(index int, collision int) string
- func (self Instance) GetDrag(index int) Float.X
- func (self Instance) GetDragDampingCurve(index int) Curve.Instance
- func (self Instance) GetEndBone(index int) int
- func (self Instance) GetEndBoneDirection(index int) BoneDirection
- func (self Instance) GetEndBoneLength(index int) Float.X
- func (self Instance) GetEndBoneName(index int) string
- func (self Instance) GetExcludeCollisionCount(index int) int
- func (self Instance) GetExcludeCollisionPath(index int, collision int) string
- func (self Instance) GetGravity(index int) Float.X
- func (self Instance) GetGravityDampingCurve(index int) Curve.Instance
- func (self Instance) GetGravityDirection(index int) Vector3.XYZ
- func (self Instance) GetJointBone(index int, joint int) int
- func (self Instance) GetJointBoneName(index int, joint int) string
- func (self Instance) GetJointCount(index int) int
- func (self Instance) GetJointDrag(index int, joint int) Float.X
- func (self Instance) GetJointGravity(index int, joint int) Float.X
- func (self Instance) GetJointGravityDirection(index int, joint int) Vector3.XYZ
- func (self Instance) GetJointRadius(index int, joint int) Float.X
- func (self Instance) GetJointRotationAxis(index int, joint int) RotationAxis
- func (self Instance) GetJointRotationAxisVector(index int, joint int) Vector3.XYZ
- func (self Instance) GetJointStiffness(index int, joint int) Float.X
- func (self Instance) GetRadius(index int) Float.X
- func (self Instance) GetRadiusDampingCurve(index int) Curve.Instance
- func (self Instance) GetRootBone(index int) int
- func (self Instance) GetRootBoneName(index int) string
- func (self Instance) GetRotationAxis(index int) RotationAxis
- func (self Instance) GetRotationAxisVector(index int) Vector3.XYZ
- func (self Instance) GetStiffness(index int) Float.X
- func (self Instance) GetStiffnessDampingCurve(index int) Curve.Instance
- func (self Instance) ID() ID
- func (self Instance) IsConfigIndividual(index int) bool
- func (self Instance) IsEndBoneExtended(index int) bool
- func (self Instance) Reset()
- func (self Instance) SetCenterBone(index int, bone int)
- func (self Instance) SetCenterBoneName(index int, bone_name string)
- func (self Instance) SetCenterFrom(index int, center_from CenterFrom)
- func (self Instance) SetCenterNode(index int, node_path string)
- func (self Instance) SetCollisionCount(index int, count int)
- func (self Instance) SetCollisionPath(index int, collision int, node_path string)
- func (self Instance) SetDrag(index int, drag Float.X)
- func (self Instance) SetDragDampingCurve(index int, curve Curve.Instance)
- func (self Instance) SetEnableAllChildCollisions(index int, enabled bool)
- func (self Instance) SetEndBone(index int, bone int)
- func (self Instance) SetEndBoneDirection(index int, bone_direction BoneDirection)
- func (self Instance) SetEndBoneLength(index int, length Float.X)
- func (self Instance) SetEndBoneName(index int, bone_name string)
- func (self Instance) SetExcludeCollisionCount(index int, count int)
- func (self Instance) SetExcludeCollisionPath(index int, collision int, node_path string)
- func (self Instance) SetExtendEndBone(index int, enabled bool)
- func (self Instance) SetExternalForce(value Vector3.XYZ)
- func (self Instance) SetGravity(index int, gravity Float.X)
- func (self Instance) SetGravityDampingCurve(index int, curve Curve.Instance)
- func (self Instance) SetGravityDirection(index int, gravity_direction Vector3.XYZ)
- func (self Instance) SetIndividualConfig(index int, enabled bool)
- func (self Instance) SetJointDrag(index int, joint int, drag Float.X)
- func (self Instance) SetJointGravity(index int, joint int, gravity Float.X)
- func (self Instance) SetJointGravityDirection(index int, joint int, gravity_direction Vector3.XYZ)
- func (self Instance) SetJointRadius(index int, joint int, radius Float.X)
- func (self Instance) SetJointRotationAxis(index int, joint int, axis RotationAxis)
- func (self Instance) SetJointRotationAxisVector(index int, joint int, vector Vector3.XYZ)
- func (self Instance) SetJointStiffness(index int, joint int, stiffness Float.X)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetRadius(index int, radius Float.X)
- func (self Instance) SetRadiusDampingCurve(index int, curve Curve.Instance)
- func (self Instance) SetRootBone(index int, bone int)
- func (self Instance) SetRootBoneName(index int, bone_name string)
- func (self Instance) SetRotationAxis(index int, axis RotationAxis)
- func (self Instance) SetRotationAxisVector(index int, vector Vector3.XYZ)
- func (self Instance) SetSettingCount(value int)
- func (self Instance) SetStiffness(index int, stiffness Float.X)
- func (self Instance) SetStiffnessDampingCurve(index int, curve Curve.Instance)
- func (self Instance) SettingCount() int
- func (self Instance) Virtual(name string) reflect.Value
- type RotationAxis
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 BoneDirection ¶
type BoneDirection int //gd:SpringBoneSimulator3D.BoneDirection
const ( // Enumerated value for the +X axis. BoneDirectionPlusX BoneDirection = 0 // Enumerated value for the -X axis. BoneDirectionMinusX BoneDirection = 1 // Enumerated value for the +Y axis. BoneDirectionPlusY BoneDirection = 2 // Enumerated value for the -Y axis. BoneDirectionMinusY BoneDirection = 3 // Enumerated value for the +Z axis. BoneDirectionPlusZ BoneDirection = 4 // Enumerated value for the -Z axis. BoneDirectionMinusZ BoneDirection = 5 // Enumerated value for the axis from a parent bone to the child bone. BoneDirectionFromParent BoneDirection = 6 )
type CenterFrom ¶
type CenterFrom int //gd:SpringBoneSimulator3D.CenterFrom
const ( // The world origin is defined as center. CenterFromWorldOrigin CenterFrom = 0 // The [graphics.gd/classdb/Node3D] specified by [Instance.SetCenterNode] is defined as center. // // If [graphics.gd/classdb/Node3D] is not found, the parent [graphics.gd/classdb/Skeleton3D] is treated as center. CenterFromNode CenterFrom = 1 // The bone pose origin of the parent [graphics.gd/classdb/Skeleton3D] specified by [Instance.SetCenterBone] is defined as center. // // If [graphics.gd/classdb/Node3D] is not found, the parent [graphics.gd/classdb/Skeleton3D] is treated as center. CenterFromBone CenterFrom = 2 )
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
func (*Extension[T]) AsSkeletonModifier3D ¶
func (self *Extension[T]) AsSkeletonModifier3D() SkeletonModifier3D.Instance
func (*Extension[T]) AsSpringBoneSimulator3D ¶
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 Instance ¶
type Instance [1]gdclass.SpringBoneSimulator3D
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) AreAllChildCollisionsEnabled ¶
Returns true if all child [graphics.gd/classdb/SpringBoneCollision3D]s are contained in the collision list at 'index' in the settings.
func (Instance) AsSkeletonModifier3D ¶
func (self Instance) AsSkeletonModifier3D() SkeletonModifier3D.Instance
func (Instance) AsSpringBoneSimulator3D ¶
func (Instance) ClearCollisions ¶
Clears all collisions from the collision list at 'index' in the settings when Instance.AreAllChildCollisionsEnabled is false.
func (Instance) ClearExcludeCollisions ¶
Clears all exclude collisions from the collision list at 'index' in the settings when Instance.AreAllChildCollisionsEnabled is true.
func (Instance) ExternalForce ¶
func (Instance) GetCenterBone ¶
Returns the center bone index of the bone chain.
func (Instance) GetCenterBoneName ¶
Returns the center bone name of the bone chain.
func (Instance) GetCenterFrom ¶
func (self Instance) GetCenterFrom(index int) CenterFrom
Returns what the center originates from in the bone chain.
func (Instance) GetCenterNode ¶
Returns the center node path of the bone chain.
func (Instance) GetCollisionCount ¶
Returns the collision count of the bone chain's collision list when Instance.AreAllChildCollisionsEnabled is false.
func (Instance) GetCollisionPath ¶
Returns the node path of the graphics.gd/classdb/SpringBoneCollision3D at 'collision' in the bone chain's collision list when Instance.AreAllChildCollisionsEnabled is false.
func (Instance) GetDragDampingCurve ¶
Returns the drag force damping curve of the bone chain.
func (Instance) GetEndBone ¶
Returns the end bone index of the bone chain.
func (Instance) GetEndBoneDirection ¶
func (self Instance) GetEndBoneDirection(index int) BoneDirection
Returns the end bone's tail direction of the bone chain when Instance.IsEndBoneExtended is true.
func (Instance) GetEndBoneLength ¶
Returns the end bone's tail length of the bone chain when Instance.IsEndBoneExtended is true.
func (Instance) GetEndBoneName ¶
Returns the end bone name of the bone chain.
func (Instance) GetExcludeCollisionCount ¶
Returns the exclude collision count of the bone chain's exclude collision list when Instance.AreAllChildCollisionsEnabled is true.
func (Instance) GetExcludeCollisionPath ¶
Returns the node path of the graphics.gd/classdb/SpringBoneCollision3D at 'collision' in the bone chain's exclude collision list when Instance.AreAllChildCollisionsEnabled is true.
func (Instance) GetGravity ¶
Returns the gravity amount of the bone chain.
func (Instance) GetGravityDampingCurve ¶
Returns the gravity amount damping curve of the bone chain.
func (Instance) GetGravityDirection ¶
Returns the gravity direction of the bone chain.
func (Instance) GetJointBone ¶
Returns the bone index at 'joint' in the bone chain's joint list.
func (Instance) GetJointBoneName ¶
Returns the bone name at 'joint' in the bone chain's joint list.
func (Instance) GetJointCount ¶
Returns the joint count of the bone chain's joint list.
func (Instance) GetJointDrag ¶
Returns the drag force at 'joint' in the bone chain's joint list.
func (Instance) GetJointGravity ¶
Returns the gravity amount at 'joint' in the bone chain's joint list.
func (Instance) GetJointGravityDirection ¶
Returns the gravity direction at 'joint' in the bone chain's joint list.
func (Instance) GetJointRadius ¶
Returns the radius at 'joint' in the bone chain's joint list.
func (Instance) GetJointRotationAxis ¶
func (self Instance) GetJointRotationAxis(index int, joint int) RotationAxis
Returns the rotation axis at 'joint' in the bone chain's joint list.
func (Instance) GetJointRotationAxisVector ¶
Returns the rotation axis vector for the specified joint in the bone chain. This vector represents the axis around which the joint can rotate. It is determined based on the rotation axis set for the joint.
If Instance.GetJointRotationAxis is RotationAxisAll, this method returns Vector3(0, 0, 0).
func (Instance) GetJointStiffness ¶
Returns the stiffness force at 'joint' in the bone chain's joint list.
func (Instance) GetRadiusDampingCurve ¶
Returns the joint radius damping curve of the bone chain.
func (Instance) GetRootBone ¶
Returns the root bone index of the bone chain.
func (Instance) GetRootBoneName ¶
Returns the root bone name of the bone chain.
func (Instance) GetRotationAxis ¶
func (self Instance) GetRotationAxis(index int) RotationAxis
Returns the rotation axis of the bone chain.
func (Instance) GetRotationAxisVector ¶
Returns the rotation axis vector of the bone chain. This vector represents the axis around which the bone chain can rotate. It is determined based on the rotation axis set for the bone chain.
If Instance.GetRotationAxis is RotationAxisAll, this method returns Vector3(0, 0, 0).
func (Instance) GetStiffness ¶
Returns the stiffness force of the bone chain.
func (Instance) GetStiffnessDampingCurve ¶
Returns the stiffness force damping curve of the bone chain.
func (Instance) IsConfigIndividual ¶
Returns true if the config can be edited individually for each joint.
func (Instance) IsEndBoneExtended ¶
Returns true if the end bone is extended to have the tail.
func (Instance) Reset ¶
func (self Instance) Reset()
Resets a simulating state with respect to the current bone pose.
It is useful to prevent the simulation result getting violent. For example, calling this immediately after a call to graphics.gd/classdb/AnimationPlayer.Instance.Play without a fading, or within the previous [Instance.OnSkeletonmodifier3d.ModificationProcessed] signal if it's condition changes significantly.
func (Instance) SetCenterBone ¶
Sets the center bone index of the bone chain.
func (Instance) SetCenterBoneName ¶
Sets the center bone name of the bone chain.
func (Instance) SetCenterFrom ¶
func (self Instance) SetCenterFrom(index int, center_from CenterFrom)
Sets what the center originates from in the bone chain.
Bone movement is calculated based on the difference in relative distance between center and bone in the previous and next frames.
For example, if the parent graphics.gd/classdb/Skeleton3D is used as the center, the bones are considered to have not moved if the graphics.gd/classdb/Skeleton3D moves in the world.
In this case, only a change in the bone pose is considered to be a bone movement.
func (Instance) SetCenterNode ¶
Sets the center node path of the bone chain.
func (Instance) SetCollisionCount ¶
Sets the number of collisions in the collision list at 'index' in the settings when Instance.AreAllChildCollisionsEnabled is false.
func (Instance) SetCollisionPath ¶
Sets the node path of the graphics.gd/classdb/SpringBoneCollision3D at 'collision' in the bone chain's collision list when Instance.AreAllChildCollisionsEnabled is false.
func (Instance) SetDrag ¶
Sets the drag force of the bone chain. The greater the value, the more suppressed the wiggling.
The value is scaled by Instance.SetDragDampingCurve and cached in each joint setting in the joint list.
func (Instance) SetDragDampingCurve ¶
Sets the drag force damping curve of the bone chain.
func (Instance) SetEnableAllChildCollisions ¶
If 'enabled' is true, all child [graphics.gd/classdb/SpringBoneCollision3D]s are colliding and Instance.SetExcludeCollisionPath is enabled as an exclusion list at 'index' in the settings.
If 'enabled' is false, you need to manually register all valid collisions with Instance.SetCollisionPath.
func (Instance) SetEndBone ¶
Sets the end bone index of the bone chain.
func (Instance) SetEndBoneDirection ¶
func (self Instance) SetEndBoneDirection(index int, bone_direction BoneDirection)
Sets the end bone tail direction of the bone chain when Instance.IsEndBoneExtended is true.
func (Instance) SetEndBoneLength ¶
Sets the end bone tail length of the bone chain when Instance.IsEndBoneExtended is true.
func (Instance) SetEndBoneName ¶
Sets the end bone name of the bone chain.
Note: End bone must be the root bone or a child of the root bone. If they are the same, the tail must be extended by Instance.SetExtendEndBone to jiggle the bone.
func (Instance) SetExcludeCollisionCount ¶
Sets the number of exclude collisions in the exclude collision list at 'index' in the settings when Instance.AreAllChildCollisionsEnabled is true.
func (Instance) SetExcludeCollisionPath ¶
Sets the node path of the graphics.gd/classdb/SpringBoneCollision3D at 'collision' in the bone chain's exclude collision list when Instance.AreAllChildCollisionsEnabled is true.
func (Instance) SetExtendEndBone ¶
If 'enabled' is true, the end bone is extended to have the tail.
The extended tail config is allocated to the last element in the joint list.
In other words, if you set 'enabled' is false, the config of last element in the joint list has no effect in the simulated result.
func (Instance) SetExternalForce ¶
func (Instance) SetGravity ¶
Sets the gravity amount of the bone chain. This value is not an acceleration, but a constant velocity of movement in Instance.SetGravityDirection.
If 'gravity' is not 0, the modified pose will not return to the original pose since it is always affected by gravity.
The value is scaled by Instance.SetGravityDampingCurve and cached in each joint setting in the joint list.
func (Instance) SetGravityDampingCurve ¶
Sets the gravity amount damping curve of the bone chain.
func (Instance) SetGravityDirection ¶
Sets the gravity direction of the bone chain. This value is internally normalized and then multiplied by Instance.SetGravity.
The value is cached in each joint setting in the joint list.
func (Instance) SetIndividualConfig ¶
If 'enabled' is true, the config can be edited individually for each joint.
func (Instance) SetJointDrag ¶
Sets the drag force at 'joint' in the bone chain's joint list when Instance.IsConfigIndividual is true.
func (Instance) SetJointGravity ¶
Sets the gravity amount at 'joint' in the bone chain's joint list when Instance.IsConfigIndividual is true.
func (Instance) SetJointGravityDirection ¶
Sets the gravity direction at 'joint' in the bone chain's joint list when Instance.IsConfigIndividual is true.
func (Instance) SetJointRadius ¶
Sets the joint radius at 'joint' in the bone chain's joint list when Instance.IsConfigIndividual is true.
func (Instance) SetJointRotationAxis ¶
func (self Instance) SetJointRotationAxis(index int, joint int, axis RotationAxis)
Sets the rotation axis at 'joint' in the bone chain's joint list when Instance.IsConfigIndividual is true.
The axes are based on the graphics.gd/classdb/Skeleton3D.Instance.GetBoneRest's space, if 'axis' is RotationAxisCustom, you can specify any axis.
Note: The rotation axis and the forward vector shouldn't be colinear to avoid unintended rotation since graphics.gd/classdb/SpringBoneSimulator3D does not factor in twisting forces.
func (Instance) SetJointRotationAxisVector ¶
Sets the rotation axis vector for the specified joint in the bone chain.
This vector is normalized by an internal process and represents the axis around which the bone chain can rotate.
If the vector length is 0, it is considered synonymous with RotationAxisAll.
func (Instance) SetJointStiffness ¶
Sets the stiffness force at 'joint' in the bone chain's joint list when Instance.IsConfigIndividual is true.
func (Instance) SetRadius ¶
Sets the joint radius of the bone chain. It is used to move and slide with the graphics.gd/classdb/SpringBoneCollision3D in the collision list.
The value is scaled by Instance.SetRadiusDampingCurve and cached in each joint setting in the joint list.
func (Instance) SetRadiusDampingCurve ¶
Sets the joint radius damping curve of the bone chain.
func (Instance) SetRootBone ¶
Sets the root bone index of the bone chain.
func (Instance) SetRootBoneName ¶
Sets the root bone name of the bone chain.
func (Instance) SetRotationAxis ¶
func (self Instance) SetRotationAxis(index int, axis RotationAxis)
Sets the rotation axis of the bone chain. If set to a specific axis, it acts like a hinge joint. The value is cached in each joint setting in the joint list.
The axes are based on the graphics.gd/classdb/Skeleton3D.Instance.GetBoneRest's space, if 'axis' is RotationAxisCustom, you can specify any axis.
Note: The rotation axis vector and the forward vector shouldn't be colinear to avoid unintended rotation since graphics.gd/classdb/SpringBoneSimulator3D does not factor in twisting forces.
func (Instance) SetRotationAxisVector ¶
Sets the rotation axis vector of the bone chain. The value is cached in each joint setting in the joint list.
This vector is normalized by an internal process and represents the axis around which the bone chain can rotate.
If the vector length is 0, it is considered synonymous with RotationAxisAll.
func (Instance) SetSettingCount ¶
func (Instance) SetStiffness ¶
Sets the stiffness force of the bone chain. The greater the value, the faster it recovers to its initial pose.
If 'stiffness' is 0, the modified pose will not return to the original pose.
The value is scaled by Instance.SetStiffnessDampingCurve and cached in each joint setting in the joint list.
func (Instance) SetStiffnessDampingCurve ¶
Sets the stiffness force damping curve of the bone chain.
func (Instance) SettingCount ¶
type RotationAxis ¶
type RotationAxis int //gd:SpringBoneSimulator3D.RotationAxis
const ( // Enumerated value for the rotation of the X axis. RotationAxisX RotationAxis = 0 // Enumerated value for the rotation of the Y axis. RotationAxisY RotationAxis = 1 // Enumerated value for the rotation of the Z axis. RotationAxisZ RotationAxis = 2 // Enumerated value for the unconstrained rotation. RotationAxisAll RotationAxis = 3 // Enumerated value for an optional rotation axis. See also [Instance.SetJointRotationAxisVector]. RotationAxisCustom RotationAxis = 4 )