Discussions

SmileBASIC Community

DeadAxlekoolkermit

04/07/2016 11:52 PM ·Spoilers

Open Closed

Gravity simulation?

So I'm trying to make two objects attract towards each other using Newton equation of gravity, but I have no idea how to code this. If someone could make a little demo I can understand by reading the code.

Advertisement

Comment

This post has no comments.

  • I'm trying to make one... Newton's gravity equation helps a lot, combined with some trig.

    Yeahs2
    Played
  • Oh, cool! Thanks a lot. I might use this in my Orbit game actually.

    Yeahs0
    Played
  • I never knew Newton's laws and other scientific laws can work in programming! :0

    Yeahs0
    Played
  • Zee

    04/10/2016 1:23 PM ·Spoilers

    Well many laws use equations, and math uses equations. Programming also uses equations. I have the gravity equation set, but my problem right now is working with Newton's laws of motion (an object in motion currently DOES NOT stay in motion), and direction never changes. But I'm working on it. Just gotta find the proper math.

    Yeahs0
    Played
  • I'm actually the top student in my math class (I can do calculus), but I'm not the best when it comes to programming (and yet I made a 3D engine. I'm still not awesome tho). How's about you let me fiddle around with your project?

    Yeahs0
    Played
  • Zee

    04/10/2016 2:13 PM ·Spoilers

    I'd prefer to try to do it on my own. I feel like I'm at least acceptable (though I'm not quite to the higher points in math, like calculus) and I'm close enough that I could make it work myself. If I can't then I'll definitely give it to you, but I don't feel it's at that point yet.

    Yeahs0
    Played
  • That's totally okay! Take your time. Btw is the program going to have touch screen support? Like, you could tap on the screen to make a planet, or drag while still pressing to give it speed.

    Yeahs0
    Played
  • Zee

    04/10/2016 6:30 PM ·Spoilers

    Yeah, though right now I'm working on the physics rather than the UI, though it will not be difficult after that.

    Yeahs0
    Played
  • Mkay, here: Two circles will bounce around the screen, and will be attracted to each other using realistic planetary physics.

    Yeahs1
    Played
  • ^ if thats what you were looking for

    Yeahs0
    Played
  • Thanks! I'll try it in a bit.

    Yeahs0
    Played
  • By looking at the paths you can tell the precision isnt perfect (they wobble a bit) But they do attract each other the closer they are to each other

    Yeahs1
    Played

Add a Comment

You must sign in to post a comment.

Sign in using a Nintendo Network ID to connect to users around the world by writing posts and comments and by giving Yeahs to other people's posts. You can create a Nintendo Network ID using your Wii U console or your system in the Nintendo 3DS family.

Use of Miiverse Details about Miiverse

Report Violation to Miiverse Administrators

You are about to report a post with content which violates the Miiverse Code of Conduct. This report will be sent to Nintendo's Miiverse administrators and not to the creator of the post.

Violation Type:

Post ID: 3DB-NBL7-BXM-ZM9B-XU2-F4VX

Report Violation to Miiverse Administrators

You cannot report posts made automatically by a software title.

Edit Post

Select an action: