Answer the question
In order to leave comments, you need to log in
How to calculate the coordinates for translate(x, y) relative to the viewport's coordinate system and not the object's coordinate system?
How to calculate the coordinates for translate(x, y) relative to the viewport's coordinate system and not the object's coordinate system?
This comment perfectly describes the problem:
The most interesting and non-obvious feature of transformations was not reflected: the fact that the transformation changes exactly the coordinate system of the object. For example, if an object is rotated 90° clockwise, despawned in half, and then tried to move 100px to the right, it will actually move 200px down, because in his coordinate system, the X-axis now looks down (and the Y-axis to the left) and each "pixel" in it is equal to two real ones.
Answer the question
In order to leave comments, you need to log in
I still don’t understand what you specifically need, but the right solution would be to decompose the matrix and change the individual transformation matrices for subsequent multiplication and get the final matrix.
I made a primitive example with matrix2d - we drag the transformed objects.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question