mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 21:53:59 +00:00
Testing rotation fix
This commit is contained in:
parent
ff809f8e6b
commit
64b3e834d3
4 changed files with 35 additions and 7 deletions
20
plugins/spine/dist/SpinePlugin.js
vendored
20
plugins/spine/dist/SpinePlugin.js
vendored
|
@ -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();
|
||||
|
|
2
plugins/spine/dist/SpinePlugin.js.map
vendored
2
plugins/spine/dist/SpinePlugin.js.map
vendored
File diff suppressed because one or more lines are too long
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue