From 2341f7752fe1fbb3117be988cdf416b6d595b84d Mon Sep 17 00:00:00 2001 From: Felipe Alfonso Date: Tue, 20 Jun 2017 16:47:43 -0400 Subject: [PATCH] Updated code for GetTransformedPoint --- v3/src/checksum.js | 2 +- .../input/components/GetTransformedPoint.js | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/v3/src/checksum.js b/v3/src/checksum.js index 226b48653..4ee9a2b8f 100644 --- a/v3/src/checksum.js +++ b/v3/src/checksum.js @@ -1,4 +1,4 @@ var CHECKSUM = { -build: '2ac4ba60-552b-11e7-965c-39a419b0ea9b' +build: '02a4bdd0-55d7-11e7-87f5-37983a7cf73e' }; module.exports = CHECKSUM; \ No newline at end of file diff --git a/v3/src/input/components/GetTransformedPoint.js b/v3/src/input/components/GetTransformedPoint.js index 2b8a346be..c1b59e1c4 100644 --- a/v3/src/input/components/GetTransformedPoint.js +++ b/v3/src/input/components/GetTransformedPoint.js @@ -10,9 +10,22 @@ var GetTransformedPoint = function (matrix, gameObject, x, y, output) { if (output === undefined) { output = { x: 0, y: 0 }; } - matrix.applyITRS(gameObject.x, gameObject.y, gameObject.rotation, gameObject.scaleX, gameObject.scaleY); - // matrix.invert(); - matrix.transformPoint(x, y, output); + matrix.applyITRS(gameObject.x, gameObject.y, -gameObject.rotation, gameObject.scaleX, gameObject.scaleY); + matrix.invert(); + // matrix.transformPoint(x, y, output); + var ma = matrix.matrix; + var a = ma[0]; + var b = ma[1]; + var c = ma[2]; + var d = ma[3]; + var e = ma[4]; + var f = ma[5]; + + var tx = x * a + y * c + e; + var ty = x * b + y * d + f; + + output.x = tx; + output.y = ty; // var a = matrix.matrix[0]; // var b = matrix.matrix[1];