[c][cpp] Port of commit ccc5b2f: Fixed root bone transform for skeleton. See #1379.

This commit is contained in:
badlogic 2019-06-13 16:08:04 +02:00
parent 6e54e8d819
commit b2e151f3e7
2 changed files with 4 additions and 4 deletions

View File

@ -79,8 +79,8 @@ void spBone_updateWorldTransformWith (spBone* self, float x, float y, float rota
if (!parent) { /* Root bone. */
float rotationY = rotation + 90 + shearY;
CONST_CAST(float, self->a) = COS_DEG(rotation + shearX) * scaleX * sx;
CONST_CAST(float, self->b) = COS_DEG(rotationY) * scaleY * sy;
CONST_CAST(float, self->c) = SIN_DEG(rotation + shearX) * scaleX * sx;
CONST_CAST(float, self->b) = COS_DEG(rotationY) * scaleY * sx;
CONST_CAST(float, self->c) = SIN_DEG(rotation + shearX) * scaleX * sy;
CONST_CAST(float, self->d) = SIN_DEG(rotationY) * scaleY * sy;
CONST_CAST(float, self->worldX) = x * sx + self->skeleton->x;
CONST_CAST(float, self->worldY) = y * sy + self->skeleton->y;

View File

@ -107,8 +107,8 @@ Bone::updateWorldTransform(float x, float y, float rotation, float scaleX, float
float sx = _skeleton.getScaleX();
float sy = _skeleton.getScaleY();
_a = MathUtil::cosDeg(rotation + shearX) * scaleX * sx;
_b = MathUtil::cosDeg(rotationY) * scaleY * sy;
_c = MathUtil::sinDeg(rotation + shearX) * scaleX * sx;
_b = MathUtil::cosDeg(rotationY) * scaleY * sx;
_c = MathUtil::sinDeg(rotation + shearX) * scaleX * sy;
_d = MathUtil::sinDeg(rotationY) * scaleY * sy;
_worldX = x * sx + _skeleton.getX();
_worldY = y * sy + _skeleton.getY();