Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Center of Rotation vs. Center of Mass

Author
Message
SMS
19
Years of Service
User Offline
Joined: 2nd Dec 2004
Location: United States
Posted: 4th Dec 2011 00:28
The documentation makes reference to a "center of rotation" in addition to center of mass, as if they were different.

ie:

"Setting it to 0,0 will put the COM on the sprite's offset point (and center of rotation)."

Please excuse me... but what in Hades is the "center of rotation"???

Can it be set? Can it be, ah... get?

It seems to me that the center of mass should be the center of rotation... yes?
Hodgey
14
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 4th Dec 2011 02:02
The center of mass is well I suppose the point where an object is symetrical in mass in every direction. The center of rotation is...well pretty self explanetory if you ask me. I think however the center of rotation can be moved as you desire. Take a knife for instance. The center of mass will always be in one place but you could change the center of rotation to be at the tip of the blade, the center of the knife or at the end of the handle. It might not even have to be on the knife it could be external to it as well. Changing the center of rotation simply changes how the object rotates. Well that's my understanding of it atleast.

SMS
19
Years of Service
User Offline
Joined: 2nd Dec 2004
Location: United States
Posted: 4th Dec 2011 03:59 Edited at: 4th Dec 2011 04:30
Right, so if you apply a force to an object off of it's center of mass... it will begin to rotate around the center of mass (unless otherwise constrained)

So that makes the concept of some different "center of rotation" somewhat of a mystery...

You mention that you think the center of rotation can be moved... are you aware of any commands to do this?

Thanks.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 4th Dec 2011 10:12
If you set the angle of a sprite it's angle will be set about the top left corner of the sprite unless you use "setSpriteAngleByOffset", this will rotate it around the offset point (COM on a physics sprite).

COM is the offset point of a physics sprite that it is rotated about.

In other words the Centre of Rotation is the Centre of Mass on a physics sprite. On a none physics sprite this is the top left corner of the sprite unless you use "setSpriteOffset".

SMS
19
Years of Service
User Offline
Joined: 2nd Dec 2004
Location: United States
Posted: 4th Dec 2011 17:57
Ahh... I see... two different methods for two different states!

So really there is no distinct "center of rotation" at all... just the COM and the sprite offset.

So perhaps the documentation, instead of saying this:
"Setting it to 0,0 will put the COM on the sprite's offset point (and center of rotation)."

Should say this:
"Setting it to 0,0 will put the COM on the sprite's offset point."
SMS
19
Years of Service
User Offline
Joined: 2nd Dec 2004
Location: United States
Posted: 4th Dec 2011 18:02
@baxslash

I just tested SetSpriteAngle() on both a physics sprite and a non physics sprite, and it seems to behave differently than your description.

On a physics sprite, it rotates about the COM (as expected)

On a non physics sprite, it doesn't rotate about the top left... it rotates about the offset.

I don't see that there is a SetSpriteAngleByOffset() command.

Regards,
SMS
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 4th Dec 2011 20:09
No you're right I'm remembering it wrong. There is only one "setSpriteAngle" command. When there's no offset applied a normal sprite would just rotate around it's top left.

SMS
19
Years of Service
User Offline
Joined: 2nd Dec 2004
Location: United States
Posted: 4th Dec 2011 20:12
Right... though I *think* there is always an offset... it's just that before it is set by the user, it is at 0,0.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 4th Dec 2011 21:26
Quote: "When there's no offset applied a normal sprite would just rotate around it's top left."

...that's effectively an offset of 0,0. I could argue that an offset of zero is actually not an offset but I won't do that... damn, just did

SMS
19
Years of Service
User Offline
Joined: 2nd Dec 2004
Location: United States
Posted: 4th Dec 2011 21:40
One could argue that zero is not a number

Login to post a reply

Server time is: 2024-05-04 13:45:52
Your offset time is: 2024-05-04 13:45:52