Skip to content

Commit

Permalink
[ts] Aligned Skeleton updateWorldTransformWith with reference runtime.
Browse files Browse the repository at this point in the history
…Close #2695.
  • Loading branch information
davidetan committed Nov 26, 2024
1 parent 8c66239 commit dc2bcb0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions spine-ts/spine-core/src/Skeleton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,20 @@ export class Skeleton {
}

updateWorldTransformWith (physics: Physics, parent: Bone) {
if (!parent) throw new Error("parent cannot be null.");

let bones = this.bones;
for (let i = 1, n = bones.length; i < n; i++) { // Skip root bone.
let bone = bones[i];
bone.ax = bone.x;
bone.ay = bone.y;
bone.arotation = bone.rotation;
bone.ascaleX = bone.scaleX;
bone.ascaleY = bone.scaleY;
bone.ashearX = bone.shearX;
bone.ashearY = bone.shearY;
}

// Apply the parent bone transform to the root bone. The root bone always inherits scale, rotation and reflection.
let rootBone = this.getRootBone();
if (!rootBone) throw new Error("Root bone must not be null.");
Expand Down

0 comments on commit dc2bcb0

Please sign in to comment.