Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark Physics & Dark A.I. & Dark Dynamix / Planetary gravity help

Merak Spielman
Years of Service
User Offline
Joined: 14th Jul 2008
Posted: 21st Mar 2010 09:20
It's fairly simple to use Newton's equation to determine the attractive force between two objects.

But that's where I got stuck...

I have two spheres of known size, mass, and position.

Using Newton's equation, I know the amount of gravitational force pulling them together.

I also have a function that allows me to apply force to an object.

Now here's where I get stuck... the force I apply to the object has be in the format of (x,y,z) with the amount of force on each axis inputted.

If I remember my math correctly, I have to use a trig function here, probably a cosine... But I can't remember exactly how.

Here is my code so far:

Now I just need to use this function somehow to compute how to move my objects:


Where x is the force applied to the x axis, and so forth.

I need to figure the equation, using my TotalForce number, to figure out those 3 axis inputs.
Matty H
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 21st Mar 2010 13:36

I think you are using my lib so I posted on that thread so it may help other people also.

Login to post a reply

Server time is: 2023-02-01 16:16:50
Your offset time is: 2023-02-01 16:16:50