mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[lua] Port of commit ccc5b2f: Fixed root bone transform for skeleton. See #1379.
This commit is contained in:
parent
b500055baf
commit
6e54e8d819
@ -94,7 +94,7 @@ function Bone:updateWorldTransformWith (x, y, rotation, scaleX, scaleY, shearX,
|
|||||||
self.ashearX = shearX
|
self.ashearX = shearX
|
||||||
self.ashearY = shearY
|
self.ashearY = shearY
|
||||||
self.appliedValid = true
|
self.appliedValid = true
|
||||||
|
|
||||||
local sx = self.skeleton.scaleX;
|
local sx = self.skeleton.scaleX;
|
||||||
local sy = self.skeleton.scaleY;
|
local sy = self.skeleton.scaleY;
|
||||||
|
|
||||||
@ -102,11 +102,11 @@ function Bone:updateWorldTransformWith (x, y, rotation, scaleX, scaleY, shearX,
|
|||||||
if parent == nil then
|
if parent == nil then
|
||||||
local rotationY = rotation + 90 + shearY
|
local rotationY = rotation + 90 + shearY
|
||||||
local rotationRad = math_rad(rotation + shearX)
|
local rotationRad = math_rad(rotation + shearX)
|
||||||
local rotationYRad = math_rad(rotationY)
|
local rotationYRad = math_rad(rotationY)
|
||||||
local skeleton = self.skeleton
|
local skeleton = self.skeleton
|
||||||
self.a = math_cos(rotationRad) * scaleX * sx
|
self.a = math_cos(rotationRad) * scaleX * sx
|
||||||
self.b = math_cos(rotationYRad) * scaleY * sy
|
self.b = math_cos(rotationYRad) * scaleY * sx
|
||||||
self.c = math_sin(rotationRad) * scaleX * sx
|
self.c = math_sin(rotationRad) * scaleX * sy
|
||||||
self.d = math_sin(rotationYRad) * scaleY * sy
|
self.d = math_sin(rotationYRad) * scaleY * sy
|
||||||
self.worldX = x * sx + skeleton.x
|
self.worldX = x * sx + skeleton.x
|
||||||
self.worldY = y * sy + skeleton.y
|
self.worldY = y * sy + skeleton.y
|
||||||
@ -160,7 +160,7 @@ function Bone:updateWorldTransformWith (x, y, rotation, scaleX, scaleY, shearX,
|
|||||||
self.a = pa * la - pb * lc
|
self.a = pa * la - pb * lc
|
||||||
self.b = pa * lb - pb * ld
|
self.b = pa * lb - pb * ld
|
||||||
self.c = pc * la + pd * lc
|
self.c = pc * la + pd * lc
|
||||||
self.d = pc * lb + pd * ld
|
self.d = pc * lb + pd * ld
|
||||||
elseif transformMode == TransformMode.noScale or transformMode == TransformMode.noScaleOrReflection then
|
elseif transformMode == TransformMode.noScale or transformMode == TransformMode.noScaleOrReflection then
|
||||||
local cos = math_cos(math_rad(rotation))
|
local cos = math_cos(math_rad(rotation))
|
||||||
local sin = math_sin(math_rad(rotation))
|
local sin = math_sin(math_rad(rotation))
|
||||||
@ -184,9 +184,9 @@ function Bone:updateWorldTransformWith (x, y, rotation, scaleX, scaleY, shearX,
|
|||||||
self.a = za * la + zb * lc
|
self.a = za * la + zb * lc
|
||||||
self.b = za * lb + zb * ld
|
self.b = za * lb + zb * ld
|
||||||
self.c = zc * la + zd * lc
|
self.c = zc * la + zd * lc
|
||||||
self.d = zc * lb + zd * ld
|
self.d = zc * lb + zd * ld
|
||||||
end
|
end
|
||||||
|
|
||||||
self.a = self.a * sx
|
self.a = self.a * sx
|
||||||
self.b = self.b * sx
|
self.b = self.b * sx
|
||||||
self.c = self.c * sy
|
self.c = self.c * sy
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user