トピック
DeadAxle koolkermit

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.
1そうだね
プレイ済み
返信[1]
親投稿
Zee Storybookten9
I'm trying to make one... Newton's gravity equation helps a lot, combined with some trig.
2そうだね
プレイ済み
返信[2]
親投稿
DeadAxle koolkermit
Oh, cool! Thanks a lot. I might use this in my Orbit game actually.
0そうだね
プレイ済み
返信[3]
親投稿
Clayton DarkClay88
I never knew Newton's laws and other scientific laws can work in programming! :0
0そうだね
プレイ済み
返信[4]
親投稿
Zee Storybookten9
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.
0そうだね
プレイ済み
返信[5]
親投稿
DeadAxle koolkermit
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?
0そうだね
プレイ済み
返信[6]
親投稿
Zee Storybookten9
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.
0そうだね
プレイ済み
返信[7]
親投稿
DeadAxle koolkermit
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.
0そうだね
プレイ済み
返信[8]
親投稿
Zee Storybookten9
Yeah, though right now I'm working on the physics rather than the UI, though it will not be difficult after that.
0そうだね
プレイ済み
返信[9]
親投稿
SıмΞоп SimeonW
Mkay, here: Two circles will bounce around the screen, and will be attracted to each other using realistic planetary physics.
1そうだね
プレイ済み
返信[10]
親投稿
SıмΞоп SimeonW
^ if thats what you were looking for
0そうだね
プレイ済み
返信[11]
親投稿
DeadAxle koolkermit
Thanks! I'll try it in a bit.
0そうだね
プレイ済み
返信[12]
親投稿
SıмΞоп SimeonW
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
1そうだね
プレイ済み