## Rotation Matrix and Trig "Workaround"

Wow! This article seems to have changed a great deal since I was active no the Scratch wiki. Anyway, down to business. The "creating gravity using rotation" seems to be focusing on rotation a sprite around an external point. It states that one must redefine the center of the sprite for every costume, but couldn't one use the rotation matrix? If I were to work this out (I think I already have a working equation that may need some minor tweaks), should I replace the original (as a few mathematical operators seems far more convenient and seems a more elegant solution than the current one), or offer it in addition to it?

Secondly, though this topic has been broached before, it was almost a year ago so I'm bringing it back up:

Molybdenum claimed that trig is not required to simulate gravity. I believe this is true:

Gravity is inversely proportional to the square of the distance of two objects. For the purpose of this article, we are essentially only concerned with the acceleration it causes: a = GM/r2. G is a constant and so is (for our purposes) M so: a = c/r2

If I need to I'll show you guys my reasoning but essentially: ax = (c/r2)*(dxx)/(d) ay = (c/r2)*(dyx)/(d)

I know that the attitude in this community when I left seemed to be one of "edit first, ask questions later" or, perhaps "edit boldly", these are some big changes and I've been gone for a while, so I'm throwing this out before I do anything.

MoreGamesNow (talk | contribs) 07:42, 25 November 2013 (UTC)

## Why trignometry?

I wonder why this article starts with saying that trignometry is required. Simulating gravity is actually quite simple and does not require trig at all, certainly in a 2d environment. Gravity is a downwards force, all you have to do is give a sprite (y speed) and (x speed) variables. (x speed) is not changed by gravity at all.

The method decribed here but it needs some cleaning up when to use this and when to use noral (x speed) and (y speed)

Thoughts?

JSO (talk | contribs) 22:51, 16 October 2010 (UTC)

You don't understand the purpose of this article. This is explaining how to create gravity that attracts objects to a certain point. For example it will attract objects to the center of the screen. Its not meant for explaining how to create gravity that just pulls stuff down. Creating simple downward gravity is explained at the end of the article under gravity in scrollers.
Dazman (talk | contribs)
Maybe another title change is necessary.
Dazman (talk | contribs) 22:57, 16 October 2010 (UTC)
I have an example project that shows how it works here.
Dazman (talk | contribs) 23:00, 16 October 2010 (UTC)

I don't think a title change is necessary... It says gravity, and it gives a link to the Wikipedia page on gravity. Gravity is absolutely nothing to do with being pulled downwards. When people refer to gravity in scrollers, it is not gravity as such, and more a realistic jumping method.
WeirdF (talk | contribs) 06:46, 17 October 2010 (UTC)

Gravity on earth is a downwards force for sure, so a 2d representation of gravity on earth in Scratch would be what is described as gravity in scrollers in this article. When you jump on earth and you are pulled back from flying into space, the force attracting you to the earth is gravity. A 'realistic jumping method' as you decribed is nothing but a representation of gravity as seen through human eyes on eath. However, gravity as a downwards force is not restricted to use in 'scrollers' at all. Basically every simulation that tries to represent a situation as seen on our earth will simulate downwards gravity in Scratch's 2d environment. That goes from scrollers, to Pinball games, to building games, to realistic rain animation, anything. I do appreciate the kind of gravity described in this article (gravity between objects with a huge mass, as seen from space in our world) but it is important that the article makes clear that this is a special form of gravity, and that one will use normal (x speed) and (y speed) methods for most applications. I suggest we place a link on the beginning of the article, create a new tutorial about simple gravity and certainly make clear that the simple method can be used in a wide variety of project, and not only in 'scrollers' as the current section title implies.
JSO (talk | contribs) 17:15, 18 October 2010 (UTC)
JSO put it well. Just a couple name changes and adding more detail should help. I too was worried when I wrote the article that people might be confused. Thats why included the gravity in scrollers part.
Dazman (talk | contribs) 18:24, 18 October 2010 (UTC)

## Splitting Article

Lucario621 (talk | contribs) 21:51, 21 January 2012 (UTC)

Seems like a good idea to me.
Jonathanpb (talk | contribs) 03:41, 22 January 2012 (UTC)
I think we should create a "Simplified Gravity Simpulation" article as the so-called 'scroller' gravity but leave the "Gravity Simulation" article as the 'accurate' gravity.
Hardmath123 (talk | contribs) 08:39, 22 January 2012 (UTC)
Actually, I just read the article through thoroughly, and I think we have many gravities on our hands:
• Falling-to-the-ground "scroller" gravity
• Super-Mario-Galaxy-gravity-towards-planet "orbital" gravity
• Realistic massive-object-in-space-inverse-square "Newtonian" gravity
We should have separate articles for all three.
On a side note, how do you get to know the top searched Wiki articles, and what are they? I'm curious .
Hardmath123 (talk | contribs) 08:47, 22 January 2012 (UTC)
That means a bunch of gravity articles. Maybe even enough to warrant Category:Gravity Tutorials (subcategory of Scripting Tutorials).
And yeah, I wonder where he got the stats.
Scimonster (talk | contribs) 10:52, 22 January 2012 (UTC)

## Math fail

Trig is not required to simulate planet gravity. I would upload the project, but unfortunatly, I am banned. Could anyone get me unbanned so I can upload the project?
Molybdenum (talk | contribs) 14:50, 2 December 2012 (UTC)

Scimonster (talk | contribs) 17:11, 2 December 2012 (UTC)
I have. They ignored me.
Molybdenum (talk | contribs) 17:17, 2 December 2012 (UTC)

## Gravity with Velocity

Hello! For simulating Gravity with the Velocity method you use

```when flag clicked
go to x: (0) y: (0)
forever
change y by (Y Velocity)
set [Y Velocity v] to ((Y Velocity) * (0.98))
```

The 0.98 will make the sprite fall slower the closer it comes to the "earth", won't it? If yes: Shouldn't the sprite be falling faster the closer it comes to the earth? Not sure if I understood it correctly though. - LiFaytheGoblin (Talk) 12:04, 29 August 2013 (UTC)

So, no opinions on this? Anyone? - LiFaytheGoblin (Talk) 16:55, 1 September 2013 (UTC)
Yes, there is an opinion, just that I hadn't noticed this yet. And yes, you are correct that the 0.98 would make the sprite fall slower the closer you got. This needs to be fixed.
ErnieParke (talk | contribs) 17:00, 1 September 2013 (UTC)
Never mind about that; the scripts are correct. If you look:
```when flag clicked
go to x: (0) y: (0)
forever
change y by (Y Velocity)
set [Y Velocity v] to ((Y Velocity) * (0.98))
```
```when flag clicked
forever
if <not<touching [Ground v]?>>
change [Y Velocity v] by (-0.1)
end
```
The second script takes care of falling faster the closer you are to the ground. The first script simply simulates air drag, so nothing is wrong there.
ErnieParke (talk | contribs) 17:16, 1 September 2013 (UTC)
Ah okay. Thanks for the reply. - LiFaytheGoblin (Talk|Contributions) 19:03, 1 September 2013 (UTC)

One of example projects is dead link, I think or can anyone see that link? And I mean https://scratch.mit.edu/projects/14875141/.
-unsigned comment by Moigam (talk | contribs)

## Change A Photo

One of the photos in the rotation method is not taken from 3.0, and is outdated. Can someone fix this?
CookiesAreSoooYummy (talk | contribs) 06:18, 23 October 2022 (UTC)

Cookies help us deliver our services. By using our services, you agree to our use of cookies.