# Orbital Motion Scripting

I'm pretty new to here but I've been using 3ds max for a while now and I've decided to undertake a challenge. This challenge is writing a maxscript that will allow me to simulate orbital motion. Now I know this sounds crazy but I want to write this script then distribute it freely because I believe everyone deserves to have access to something of this power.

Firstly this script could evolve and maybe become something far beyond what I've envisioned for it right now but that doesn't matter although I'm open to ideas. I've already thought up an initial methodology for calculating the gravitational attraction between the objects in a scene. I am aware that the calculation times could become exponentially great with the number of objects but there are workarounds that I've already thought up.

I have so far had no experience in writing maxscript but I do have an understanding of programming in general, more so the logic rather than the actual programming itself. That is why I have come here seeking help. I need to gain the knowledge in order to do the scripting but I would rather have members of the community support me and help me through the tricky bits of the coding and these people will be given full credit.

Now to outline the basic principle upon which this script will operate remains. Here I will do so:

- Firstly take a spherical object, one that which has a radius of R and a centre of mass M with a volume V.
- Taking a second spherical object with a radius G and a centre of mass H with a volume E.
- These two objects have spacial coordinates x, y and z.
- The coordinates of the centre of mass can easily be found by placing the pivot of the object at the centre using Max's own tools.
- Then using the coordinates of the centre of masses the distance between the objects can be found. It is important to note that the system must be set to use kilometers or else it will be pointless to use the formulas.
- Then by applying Newton's Gravitational formula the rest becomes easy work.
- Using the sum of the vectoral representations of the velocities of the object the object can be made to evolve through time to simulate that of orbital motion.
- The velocities can be represented with vectors in the form of meters or kilometers per frame. Per frame being the key notion in that it simplifies the process of calculating the objects position over time.

I hope that maybe this idea has aroused interest and so I hope that you would contact me at my email address. Thank you so much. I would be grateful even if someone were to point me in the right direction.

Thanks,

Microno

## Comments

## Hi,I did something like that

Hi,

I did something like that a few years back. I was more focused on our solarsystem specificly which could be your "evolve and become something far beyond".

regretably, the harddisk containing the script died.

The idea to make it work with a grav-field, rather then with paths is nice, but if you plan to expand beyond 2 bodies, this wil surley not be "easy work" as you state.

anyway... i think people on this forum are always willing to get you trough the tricky bits, if you put some effort in it yourself. even without credit :)

I think you should (ofcourse) start by learning maxscript. One of the first "working scripts" in the book "maxscript essentials" (read it) is in fact a very simple sun+planets-creation thingy. this could appeal to you.

Studio3DR.nl