Stores a bone's current pose.
A bone has a local transform which is used to compute its world transform. A bone also has an applied transform, which is a local transform that can be applied to compute the world transform. The local transform and applied transform may differ if a constraint or application code modifies the world transform after it was computed from the local transform.
Constructor
Variables
a:Float = 0.0
Part of the world transform matrix for the X axis. If changed, appliedValid
should be set to false.
read onlyactive:Bool = false
Returns false when the bone has not been computed because BoneData.skinRequired
is true and the
active Skeleton.skin
skin does not contain this bone in Skin.bones
.
appliedValid:Bool = false
If true, the applied transform matches the world transform. If false, the world transform has been modified since it was
computed and updateAppliedTransform
must be called before accessing the applied transform.
b:Float = 0.0
Part of the world transform matrix for the Y axis. If changed, appliedValid
should be set to false.
c:Float = 0.0
Part of the world transform matrix for the X axis. If changed, appliedValid
should be set to false.
d:Float = 0.0
Part of the world transform matrix for the Y axis. If changed, appliedValid
should be set to false.
Methods
getWorldScaleX():Float
The magnitude (always positive) of the world scale X, calculated using a
and c
.
getWorldScaleY():Float
The magnitude (always positive) of the world scale Y, calculated using b
and d
.
inlineisActive():Bool
Returns false when the bone has not been computed because BoneData.skinRequired
is true and the
active Skeleton.skin
skin does not contain this bone in Skin.bones
.
localToWorld(local:Vector2):Vector2
Transforms a point from the bone's local coordinates to world coordinates.
rotateWorld(degrees:Float):Void
Rotates the world transform the specified amount and sets appliedValid
to false.
updateWorldTransform
will need to be called on any child bones, recursively, and any constraints reapplied.
inlineupdate():Void
Same as updateWorldTransform
. This method exists for Bone to implement Updatable
.
updateAppliedTransform():Void
Computes the applied transform values from the world transform. This allows the applied transform to be accessed after the
world transform has been modified (by a constraint, rotateWorld
, etc).
If updateWorldTransform
has been called for a bone and appliedValid
is false, then
updateAppliedTransform
must be called before accessing the applied transform.
Some information is ambiguous in the world transform, such as -1,-1 scale versus 180 rotation. The applied transform after calling this method is equivalent to the local tranform used to compute the world transform, but may not be identical.
updateWorldTransform():Void
Computes the world transform using the parent bone and this bone's local transform.
See updateWorldTransformWith
.
updateWorldTransformWith(x:Float, y:Float, rotation:Float, scaleX:Float, scaleY:Float, shearX:Float, shearY:Float):Void
Computes the world transform using the parent bone and the specified local transform. Child bones are not updated.
See World transforms in the Spine Runtimes Guide.
worldToLocal(world:Vector2):Vector2
Transforms a point from world coordinates to the bone's local coordinates.