I made a gravity simulator during physics.
The directions should be self-explanatory. The arrow keys are used to adjust the object's mass and velocity.
I'll work on speed optimization later.
Requires OS 5.2.1 or greater because I use toString().
GIF included
Dang it!
I was going to do something just like this, but you did it much better than I could have.
Well done, and it is a very nice program.
Looks good :thumbsup:
impressive.
Could u add text with the vector data and the formulas around the lines?
Then u could actually use it in a productive way during class :)
(maybe add a tiny explosion gif in the point where they meet? :D
and btw what happens if u do parallel lines?
Reminds me of the stuff i did during school. My calculator would often get confiscated by my physics teacher, which resulted in me talking with other students instead of minding my own calculator business. Not a smart move on her part ;D
this was sooo much the same for me x.x
Quote from: p2 on May 09, 2017, 10:48:52 PM
and btw what happens if u do parallel lines?
Because both starting positions are fixed, there is no way to have parallel lines. Also, because gravity is universal, any object travelling in parallel lines won't be doing so for long.
I initially had vector data, but the speed slowdown didn't seem worth it to me.
Quote from: p2 on May 09, 2017, 10:48:52 PM
impressive.
Could u add text with the vector data and the formulas around the lines?
Then u could actually use it in a productive way during class :)
(maybe add a tiny explosion gif in the point where they meet? :D
and btw what happens if u do parallel lines?
A=F/M
Fg = M1*M2/R^2
thus
A = (M1*M2/R^2/)/ M
Each frame: calculate A for each object, add A to velocity of the object, then add velocity to the position. The more smaller the delta time, the more accurate the simulation is. (The reason the two object shoot off so fast in the gif is becouse the distance between them becomes very close to zero, thus making A approach infinity)
If you want to moddel an object and a fixed ("on rails") planet, which is a more often occurring scenario, A = (M1*M2/R^2/)/ M can be simplified to A = Mass Of Planet/R^2