# How do I implement orbits w/o physics behavior?

Get help using Construct 2

### » Sun Apr 20, 2014 1:32 pm

R0J0hound wrote:awesome stuff

ive been looking all over the forums for a couple days for solutions on how to do radial gravity(?). however all the examples i found have the bodies (planets/moons) only acting towards a central object (blackhole/sun) and ive tried to expand on the formulas but im not learned like R0J0 so i fail hard at creating a complete model where all the bodies interact with each other.

what im trying to do:
solar system with a star in the middle exerting radial gravity to the very edges of the solarsystem (layout). the star should probably not use box2d physics for mass as it would have to be impossibly huge, but instead get mass from an instance variable.

orbiting bodies(planets) that do use physics and each have radial gravity depending on physics mass (calculated by radius right?)

so for example in my fantasy version of this example it would be possible to place a large body in orbit around the star and a smaller body in orbit around the large body (ie both bodies are affected by the star gravity but the bodies also interact with each other and the large body has enough gravity to keep the smaller body in orbit, like a moon)

ill keep trying but any help would be appreciated!
B
8
S
1
Posts: 25
Reputation: 1,140

### » Mon Apr 21, 2014 11:52 pm

@openfocus
Here's a way to do it with the same formula I used before.
https://www.dropbox.com/s/eldpa0s7zvfr3 ... .capx?dl=1
/examples22/orbit2.capx

A family was used so I can pick two different instances of the same object type. Also all the numbers are kind of arbitrary, e.g. G, masses, velocities and positions. I just tweaked them until I got an acceptable motion. However there is no reason why you couldn't use scaled values from actual planet data.
Last edited by R0J0hound on Mon Jun 19, 2017 1:03 am, edited 1 time in total.
B
97
S
36
G
131
Posts: 5,513
Reputation: 83,464

### » Thu Apr 24, 2014 6:08 pm

R0J0hound wrote:@openfocus
Here's a way to do it with the same formula I used before.
https://dl.dropboxusercontent.com/u/542 ... rbit2.capx

A family was used so I can pick two different instances of the same object type. Also all the numbers are kind of arbitrary, e.g. G, masses, velocities and positions. I just tweaked them until I got an acceptable motion. However there is no reason why you couldn't use scaled values from actual planet data.

that is amazing! thanks rojo!
B
8
S
1
Posts: 25
Reputation: 1,140

### » Sun Jun 18, 2017 8:57 pm

Message: travdoty can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
R0J0hound wrote:Here is an example of an orbit based on Newton's law of universal gravitation.
https://dl.dropboxusercontent.com/u/542 ... orbit.capx

Basically it means that the velocity of the moon is taken into consideration.

Sorry for the thread necro. You wouldn't still happen to have this, would you?
B
4
S
2
Posts: 4
Reputation: 408

### » Mon Jun 19, 2017 1:03 am

B
97
S
36
G
131
Posts: 5,513
Reputation: 83,464

### » Mon Jun 19, 2017 2:14 am

Thank you. I didn't know how else to get a hold of you since the forum wouldn't go ahead and let me PM you directly yet since I just joined. If you don't mind, I may come back here to this thread to ask you questions if I need to, but this should be plenty for me to play around with.
B
4
S
2
Posts: 4
Reputation: 408

### » Mon Jun 19, 2017 2:37 am

Sure, that's fine if it's related to this. I'll eventually see any post in a topic I made or posted in. I'll also get an alert if you quote me or tag me with @R0J0hound.

If it's a different subject it's better to create a new topic and tag me if you want. That would give your question more visibility so other users more active than me can help.
B
97
S
36
G
131
Posts: 5,513
Reputation: 83,464

Previous