Question

I am trying to rotate a canvas with canvas.rotate and move an object on it at the same time. The problem is that with the rotation, the coordinate system of the canvas rotates as well, so I get cases when my object is supposed to be moving along the y axis, but the y axis is rotated on place of the x axis. It is a mess. Is there a way to go around this?

Was it helpful?

Solution

It's using matrix math; if you do things in the opposite order (translate then rotate, or vice versa), you'll get the opposite effect.

Also, use SetMatrix(null) to clear the matrix to the identity between operations; not sure if that's the kind of mess you're having trouble with.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top