Creating planetary orbits with MAX expressions


So I’ve been doing some meddling around with old-school MAX expressions in hopes that I can recreate planetary simulations with a reasonable degree of accuracy. “What’s the big deal?” you ask… “Just create a sphere with a path constraint and attach it to an ellipse shape.” Well this method fails to take into account the gravitational effect where orbiting bodies speed up slightly when they approach their perihelion (closest point) and slow down at the aphelion (furthest)


Anyway, I’ve been working on this problem for some time and can’t seem to crack the math needed for it. This is what I have so far:

…which produces this:

The blue ball has the expressions attached to it. The small white ball (inside) is a simple path constraint. Basically what I want to do here is make the blue ball speed up as it approaches the yellow ball (the “sun” I suppose) and make it slow down a little during the period when it’s furthest away. I attempted to use the yellow sphere’s distance as a function using a ExposeTransform node object, but it doesn’t allow me me to do it because of dependency loop issues. Are there any physics buffs here who can help me figure this out? I am not a scripter or a mathematician, but I know just enough to get by. Please help!!! I feel like Kepler trying to figure out calculus using a ruler and thumb-tack…This thing is driving me mad…

Creating planetary orbits with MAX expressions (Revisited)

Create elliptical spline shape around sun, add path constraint to planet to wire it to this shape and assign float expression controller to Percent property. Use this expression:


where “turn” = frames for one turn around sun and “multiplier” = multiplier for acc/brake addon (use 0.1 for start)


HOLY flippin’ Moses on a stick… that worked absolutely brilliantly!! Thank you! I never thought to multiply the sine directly. So awesome!! Now I suppose I can simply wire the multiplier value to the sun’s distance away from the center of the ellipse and divide it a bit to make it more proportional. Here’s what I actually used:


Just had to minus the sine.Works like a charm. Seriously I’ve been toiling with this damned things for days…you made my night. Thank you sir!


This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.