Discuss Scratch

cuddlyscout
Scratcher
28 posts

How do I make an image rotate around a specific coordinate?

I have been trying to make a large image move, and always spin around a specific coordinate. I read this: https://scratch.mit.edu/discuss/topic/376367/?page=1#post-3771153, and tested out the theory that a sprite rotates around the center of the canvas, and it didn't work. I think it was changed in Scratch 3.0. If anyone knows how to solve this, your help would be gladly appreciated!
NOTE: I am trying to move this large image. Shifting it off-center to the costumes canvas will not work. This image is very big, I am either switching to a blank costume and moving, or putting the costume past the validated grey areas.

Last edited by cuddlyscout (Aug. 26, 2023 13:09:22)

Your_Local_Goose
Scratcher
100+ posts

How do I make an image rotate around a specific coordinate?

cuddlyscout wrote:

I have been trying to make a large image move, and always spin around a specific coordinate. I read this: https://scratch.mit.edu/discuss/topic/376367/?page=1#post-3771153, and tested out the theory that a sprite rotates around the center of the canvas, and it didn't work. I think it was changed in Scratch 3.0. If anyone knows how to solve this, your help would be gladly appreciated!
Is this what you are looking for?

when green flag clicked
turn cw () degrees
glide () secs to x: (0) y: (0)

Or

when green flag clicked
turn cw () degrees
go to x: () y: (0)
furrysnake
Scratcher
6 posts

How do I make an image rotate around a specific coordinate?

If I had this problem, I would shift my image to be off-center in the costumes tab. The sprite always shifts and moves according to the center of the canvas.
Set the sprite's location to the coordinate point you want it to shift around and it should rotate around that specific point.
_turtle64
Scratcher
100+ posts

How do I make an image rotate around a specific coordinate?

Edit the image's costume so that it is offset from the center. You can change the distance between the image and the center of the canvas depending on how close you want the image to rotate around the point.

Then:

when green flag clicked
forever
turn cw () degrees
end

Or:

when green flag clicked
forever
turn ccw () degrees
end

If you were looking for another solution then please specify

Last edited by _turtle64 (Aug. 26, 2023 05:58:34)

cuddlyscout
Scratcher
28 posts

How do I make an image rotate around a specific coordinate?

furrysnake wrote:

If I had this problem, I would shift my image to be off-center in the costumes tab. The sprite always shifts and moves according to the center of the canvas.
Set the sprite's location to the coordinate point you want it to shift around and it should rotate around that specific point.
Thank You!, but that's not what I meant.

Last edited by cuddlyscout (Aug. 26, 2023 13:10:08)

cuddlyscout
Scratcher
28 posts

How do I make an image rotate around a specific coordinate?

I meant more like, my image is moving as well as spinning, and I always want it spin from that cord.
_turtle64
Scratcher
100+ posts

How do I make an image rotate around a specific coordinate?

Could you be more specific?
qwertycodechamp90411
Scratcher
100+ posts

How do I make an image rotate around a specific coordinate?

Note that the workaround for move 10 steps is go to x: r * cos (dir) y: r * sin (dir), using trigonomic functions.

Knowing this, we can change the dir (direction) slowly to travel in a circle.
Try this:
set [r v] to (distance to [coordinates v])
set [dir v] to (direction)
repeat (degrees)
go to x: ((r) * ([cos v] of (dir))) y: ((r) * ([sin v] of (dir)))
if that doesn't work, try setting dir to dir + 180.
cuddlyscout
Scratcher
28 posts

How do I make an image rotate around a specific coordinate?

qwertycodechamp90411 wrote:

Note that the workaround for move 10 steps is go to x: r * cos (dir) y: r * sin (dir), using trigonomic functions.

Knowing this, we can change the dir (direction) slowly to travel in a circle.
Try this:
set [r v] to (distance to [coordinates v])
set [dir v] to (direction)
repeat (degrees)
go to x: ((r) * ([cos v] of (dir))) y: ((r) * ([sin v] of (dir)))
if that doesn't work, try setting dir to dir + 180.
Thank You!

Powered by DjangoBB