This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2007-08-28 19:34:33

Shanesta
Scratcher
Registered: 2007-05-24
Posts: 6

Rotation around the center gets offset.

Ok, so I have a sprite that is 41x41 pixels wide. I have the pivot set in the dead center. I have the left and right keys set to rotate it, and when I rotate it, it is offset by a pixel.

Rotated 0 it looks right.
Rotated 90 it's offset by 1 pixel to the right
Rotated 180 it's offset by 1 pixel to the right
Rotated -90 it's offset by 1 pixel to the right

anyone else see this, or now a way around it?

I know I could manually set it back a pixel in if it is rotated other than 0, but I shouldnt have to do that if the pivot is in the dead center.

Offline

 

#2 2007-08-28 22:30:23

andresmh
Scratch Team at MIT
Registered: 2007-03-05
Posts: 1000+

Re: Rotation around the center gets offset.

This is from John: "I think this due to rounding up the half-pixel (since it's an odd number of pixels) when rotated. it could be a bug or it could just be a side effect of the pixel rotation code quantizing to the nearest pixel.

One could try rotating a costume with an even number of pixels (e.g. 40 x 40); it should not shift when rotated by multiples of 90 degrees.

I should mention that the rotation center is a pixel location even though it is shown a cross-hairs through the center of a pixel. "


Andres Monroy-Hernandez | Scratch Team at the MIT Media Lab
on identi.ca and  twitter

Offline

 

#3 2007-08-31 02:04:39

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: Rotation around the center gets offset.

I suggested some time ago that rotation centers be allowed on a half-pixel grid.  Has any thought been given to implementing this?

Offline

 

Board footer