setCenter + setRotation = wrong center

Hello,

When the rotation of a sprite is not 0, this happens:
setCenter() seems to set the center not calculated by the image borders, but the image content. This means, when you have an image sheet where something is moving around in its own frame, this sprite will wobble around, because every frame has another calculated "center".

I see that this could be intentional, but I think it’s not, because it works for me when the rotation is 0.
setcenter bug.zip (15.9 KB)

Definitely a bug. Our "pencils down" for the next release was yesterday but I'll take a look at this in the morning and squeeze a fix in if I can. Thanks for reporting this!

Got it. It's the combination of off-center rotation and padded image. (The compiler trims transparent pixels from the border of images and replaces it with a "padding" amount. It seemed like a good idea at the time, but it's caused hundreds of bugs like this. :confused:) I've got a fix in and I'll make sure that gets into the next release!

1 Like

That is great, thank you!

I think this problem has been replaced by another...

The square has its center at (0,0.5) and rotates. I would expect it should stay close to the center point?

Untitled
QnFF3hZqzdaMCXrZNSa580uuE.gif)
1.7.0 rotation offcenter bug.zip (8.6 KB)

oof. It's always something.. :confused: I'll check it out!

I was surprised I'd missed that since I was just in there with the padding bug, but on that one it wasn't rotated enough to see the error. I was scaling the rotated center point to the original image size instead of the new image. Oops. :frowning:

That's fixed, but I'll also try and fix the jittering while I'm in there.