* WalrusIRC

You need to have 5 posts and not be part of restricted usergroups in order to use the WalrusIRC embedded shoutbox. However, you can also access our IRC channel called #CodeWalrus via EFnet.

Author Topic: Gravity Simulator  (Read 445 times)

0 Members and 1 Guest are viewing this topic.

Offline ordelore

  • Full User
  • Safe-haven access
  • Join Date: Oct 2015
  • Location:
  • Posts: 86
  • Post Rating Ratio: +2/-0
  • 8x
    • @ordelore8x
    • ordelore8x
    • @UCJ9TFxpyxonUZvAv-S8K_1A
    • /u/ordelore8x
    • ordelore
    • 112/11231
    • My WIP Story
Gravity Simulator
« on: April 13, 2017, 12:15:58 am »
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
« Last Edit: April 13, 2017, 12:29:49 am by ordelore »


  • Calculators owned: TI-84+SE, TI_Nspire CX
Calc Wars is still alive (I hope)

Offline _iPhoenix_

  • Full User
  • Join Date: Mar 2017
  • Location: Encoded in Binary.
  • Posts: 331
  • Post Rating Ratio: +4/-1
  • █████ ▼ ♪ Best music ♫
    • @dj_iPhoenix
    • @UCytgMNPxAMDsxjimvxHf01w
    • @the-legend-of-iphoenix
  • Gender: Male
Re: Gravity Simulator
« Reply #1 on: April 13, 2017, 12:28:15 am »
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.
  • Calculators owned: A sentient TI-84+ CE, TI-85
  • Consoles, mobile devices and vintage computers owned: TI-99/4a home computer
Help me with a project by voting here! Thanks!

"walruses are better than tuxedo chickens, all hail the great :walrii:" ~ me

Online Alvajoy123

  • Full User
  • Join Date: Feb 2017
  • Location: USA
  • Posts: 97
  • Post Rating Ratio: +0/-2
  • The best programmer start her ~ codewalr.us
    • alvajoy asante
    • @@AlvajoyAsante
  • Gender: Male
Re: Gravity Simulator
« Reply #2 on: April 13, 2017, 02:35:13 pm »
Looks good  :thumbsup:
  • Calculators owned: TI-84+CE
??? ??? ???
Qestions are hard to ask that why we have ???
http://huggle.jdf2.org/sig/Alvajoy123.png

Offline p2

  • CodeWalrus Staff
  • Super User
  • Moderator
  • CodeWalrus Supporter
  • *
  • Join Date: Aug 2016
  • Location: Germany
  • Posts: 2259
  • Post Rating Ratio: +8/-0
  • *Wubba lubba dub dub*
    • KaliPhobos
  • Gender: Male
Re: Gravity Simulator
« Reply #3 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?
  • Calculators owned: ti-83+, ti-84+, ti-84+, ti-84+se, ti-84+se(te), ti-nsphire, ti-nsphire CX-CAS, ti-voyage, ti-voyage, Who reads this list anyways...?
Anyway war sucks. Just bring us your food instead of missiles  :P ~ DJ Omnimaga (11.10.2016 20:21:48)
if you cant get a jframe set up, draw stuff to it, and receive input, i can only imagine how horrible your game code is _._   ~ c4ooo (14.11.2016 22:44:07)
If they pull a Harambe on me tell my family I love them ~ u/Pwntear37d (AssangeWatch /r/)
make Walrii great again ~ DJ Omnimaga (28.11.2016 23:01:31)
God invented the pc, satan the smartphone I guess ~ p4nix (16.02.2017 22:51:49)

Offline Snektron

  • Lvl 69 Russian Snake
  • CodeWalrus Staff
  • Super User
  • Topic Management
  • Join Date: Dec 2014
  • Location: Netherlands
  • Posts: 3158
  • Post Rating Ratio: +32/-0
  • SSSssssss.....
    • RobinDeWalvis
    • Kzyrox
    • RobinDeWalvis
    • quantuminfinity
  • Gender: Male
Re: Gravity Simulator
« Reply #4 on: May 09, 2017, 11:04:04 pm »
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
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Offline p2

  • CodeWalrus Staff
  • Super User
  • Moderator
  • CodeWalrus Supporter
  • *
  • Join Date: Aug 2016
  • Location: Germany
  • Posts: 2259
  • Post Rating Ratio: +8/-0
  • *Wubba lubba dub dub*
    • KaliPhobos
  • Gender: Male
Re: Gravity Simulator
« Reply #5 on: May 09, 2017, 11:42:53 pm »
this was sooo much the same for me x.x
  • Calculators owned: ti-83+, ti-84+, ti-84+, ti-84+se, ti-84+se(te), ti-nsphire, ti-nsphire CX-CAS, ti-voyage, ti-voyage, Who reads this list anyways...?
Anyway war sucks. Just bring us your food instead of missiles  :P ~ DJ Omnimaga (11.10.2016 20:21:48)
if you cant get a jframe set up, draw stuff to it, and receive input, i can only imagine how horrible your game code is _._   ~ c4ooo (14.11.2016 22:44:07)
If they pull a Harambe on me tell my family I love them ~ u/Pwntear37d (AssangeWatch /r/)
make Walrii great again ~ DJ Omnimaga (28.11.2016 23:01:31)
God invented the pc, satan the smartphone I guess ~ p4nix (16.02.2017 22:51:49)

Offline ordelore

  • Full User
  • Safe-haven access
  • Join Date: Oct 2015
  • Location:
  • Posts: 86
  • Post Rating Ratio: +2/-0
  • 8x
    • @ordelore8x
    • ordelore8x
    • @UCJ9TFxpyxonUZvAv-S8K_1A
    • /u/ordelore8x
    • ordelore
    • 112/11231
    • My WIP Story
Re: Gravity Simulator
« Reply #6 on: May 10, 2017, 12:11:38 am »
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.
  • Calculators owned: TI-84+SE, TI_Nspire CX
Calc Wars is still alive (I hope)

Offline c4ooo

  • Super User
  • CW Contest II Winner
  • *
  • Join Date: Aug 2015
  • Location: 127.0.0.1
  • Posts: 945
  • Post Rating Ratio: +10/-2
  • Advanced forumer
  • Gender: Male
Re: Gravity Simulator
« Reply #7 on: May 10, 2017, 01:18:31 am »
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
« Last Edit: May 10, 2017, 09:40:38 pm by c4ooo »

 


You can also use the following HTML or bulletin board code to share it on your page or forum signature!


Also do not forget to check our affiliates below.
Planet Casio TI-Planet Calc.news BroniesQC BosaikNet Velocity Games