# Center of Rotation

First, what is the center of rotation?
I’m not quite sure this is the term for it, but it’s basically the invisible spot on an object around which the object rotates. In Hopscotch, it’s literally at the center of an object.

Next, how can this be used?
So, if, let’s say, you have a character with a sword in an RPG. He swings the sword. Since the center of rotation is at the center. The sword will appear to be swung from the center and not at the hilt.

You would need to do much more coding to make this look fine.

If you can place the center of rotation at the hilt, it would turn to look like the character had swung it.

How can this be put into code?
I actually have no clue about this one, but I’m open to ideas!

I have probably explained this poorly, so let me know if you want me to elaborate and I’ll try my best.

• This needs to be on Hopscotch!
• I’m confused.
• I don’t think this is a good idea.

0 voters

5 Likes

You can just use sin and cos

4 Likes

Sure, but they can be confusing at times, especially with less experienced coders.

5 Likes

More incentive to learn.

5 Likes

I suppose, but it would still make things easier. I mean, they’ve added Z-Index even though it is technically not necessary.

5 Likes

This seems like a very useful idea, @Fenith.
This could be like `Set Center x() y()` when the Original Center of a character is (0,0).
Sorry if this idea can cause the object to be placed offset.

4 Likes

I think that is an excellent idea. Maybe THT will decide to implement this someday.

3 Likes

I made a similar topic here too

6 Likes

Should they be merged?

2 Likes

Nah, I was just adding to the topic. You explained it much better than me.

3 Likes

This sounds like a great idea!

Actually, no. You have explained this perfectly. In fact, I understood at the first read-through of the op!

The design could be something like:
`Set Rotation Center for (object) to x_ and y_`

3 Likes

Cool idea! I’m not sure it’s necessary though as you can do this with sin/cos

1 Like

Thanks! And I actually can’t believe my gibberish is understandable, I actually thought it would be incoherent considering I composed it at 8:00 at night amid a bunch of noise.

Yeah, Rod mentioned that. Still, it would make things easier for all of us.

2 Likes

I don’t think you need the object part

3 Likes

You should see the post I once made at 1:00 AM. It actually wasn’t that bad lol.

Definitely. I often get confused by everything in the ‘math’ section, sin and cos included.

1 Like

Maybe, maybe not. On one hand, in some circumstances, it is needed where another object needs to ‘mention’ another object. Eg: When is tapped block. You choose which object it reacts to, maybe that could be the same for center of rotation. But on the other hand, I have not been able to figure what those circumstances would be for the center of rotation.

2 Likes