Testing rotation fix

This commit is contained in:
Richard Davey 2019-07-25 17:57:20 +01:00
parent ff809f8e6b
commit 64b3e834d3
4 changed files with 35 additions and 7 deletions

View file

@ -7628,6 +7628,11 @@ var CONST = __webpack_require__(/*! ../const */ "../../../src/math/const.js");
*/
var CounterClockwise = function (angle)
{
if (angle > Math.PI)
{
angle -= CONST.PI2;
}
return Math.abs((((angle + CONST.TAU) % CONST.PI2) - CONST.PI2) % CONST.PI2);
};
@ -11061,7 +11066,8 @@ var SpineGameObjectWebGLRenderer = function (renderer, src, interpolationPercent
var calcMatrix = renderer._tempMatrix3;
// - 90 degrees to account for the difference in Spine vs. Phaser rotation
spriteMatrix.applyITRS(src.x, src.y, src.rotation - 1.5707963267948966, src.scaleX, src.scaleY);
// spriteMatrix.applyITRS(src.x, src.y, src.rotation - 1.5707963267948966, src.scaleX, src.scaleY);
spriteMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY);
camMatrix.copyFrom(camera.matrix);
@ -11103,7 +11109,15 @@ var SpineGameObjectWebGLRenderer = function (renderer, src, interpolationPercent
skeleton.scaleY = calcMatrix.scaleY;
}
src.root.rotation = RadToDeg(CounterClockwise(calcMatrix.rotation));
// src.root.rotation = RadToDeg(calcMatrix.rotation);
// - 90 degrees to account for the difference in Spine vs. Phaser rotation
// Correct method via angle:
// spineBoy.root.rotation = RadToDeg(CounterClockwise(DegToRad(arrow.angle))) + 90;
// src.root.rotation = RadToDeg(CounterClockwise(calcMatrix.rotation)) + 90;
// src.root.rotation = RadToDeg(calcMatrix.rotation);
sceneRenderer.camera.position.x = viewportWidth / 2;
sceneRenderer.camera.position.y = viewportHeight / 2;
@ -11111,7 +11125,7 @@ var SpineGameObjectWebGLRenderer = function (renderer, src, interpolationPercent
sceneRenderer.camera.viewportWidth = viewportWidth;
sceneRenderer.camera.viewportHeight = viewportHeight;
sceneRenderer.camera.update();
// sceneRenderer.camera.update();
// Add autoUpdate option
skeleton.updateWorldTransform();

File diff suppressed because one or more lines are too long

View file

@ -43,7 +43,8 @@ var SpineGameObjectWebGLRenderer = function (renderer, src, interpolationPercent
var calcMatrix = renderer._tempMatrix3;
// - 90 degrees to account for the difference in Spine vs. Phaser rotation
spriteMatrix.applyITRS(src.x, src.y, src.rotation - 1.5707963267948966, src.scaleX, src.scaleY);
// spriteMatrix.applyITRS(src.x, src.y, src.rotation - 1.5707963267948966, src.scaleX, src.scaleY);
spriteMatrix.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY);
camMatrix.copyFrom(camera.matrix);
@ -85,7 +86,15 @@ var SpineGameObjectWebGLRenderer = function (renderer, src, interpolationPercent
skeleton.scaleY = calcMatrix.scaleY;
}
src.root.rotation = RadToDeg(CounterClockwise(calcMatrix.rotation));
// src.root.rotation = RadToDeg(calcMatrix.rotation);
// - 90 degrees to account for the difference in Spine vs. Phaser rotation
// Correct method via angle:
// spineBoy.root.rotation = RadToDeg(CounterClockwise(DegToRad(arrow.angle))) + 90;
// src.root.rotation = RadToDeg(CounterClockwise(calcMatrix.rotation)) + 90;
// src.root.rotation = RadToDeg(calcMatrix.rotation);
sceneRenderer.camera.position.x = viewportWidth / 2;
sceneRenderer.camera.position.y = viewportHeight / 2;
@ -93,7 +102,7 @@ var SpineGameObjectWebGLRenderer = function (renderer, src, interpolationPercent
sceneRenderer.camera.viewportWidth = viewportWidth;
sceneRenderer.camera.viewportHeight = viewportHeight;
sceneRenderer.camera.update();
// sceneRenderer.camera.update();
// Add autoUpdate option
skeleton.updateWorldTransform();

View file

@ -28,6 +28,11 @@ var CONST = require('../const');
*/
var CounterClockwise = function (angle)
{
if (angle > Math.PI)
{
angle -= CONST.PI2;
}
return Math.abs((((angle + CONST.TAU) % CONST.PI2) - CONST.PI2) % CONST.PI2);
};