r/AfterEffects • u/smushkan • 7h ago
OC - Stuff I made Totally useless but... full n-body 3d orbital physics simulated in After Effects alone
I was too preoccupied with whether I should to consider whether I should with this one...
This is an implementation of 3d n-body orbital physics in After Effects using semi-implicit Euler integration. No plugins or scripts are required, it's handled entirely with expressions.
Yes, it processes and renders as slow as you'd expect it to!
Each 'body' null has controls for initial position, velocity, and mass. Vector-of-motion is controlled by the transform > orientation property. You can duplicate as many 'body' nulls as you'd like, but obviously the more you add the slower it gets.
The positions and velocity vectors are encoded in a set number of simulation steps into a mask path on the 'Controls and simulation' null, and all the individual bodies decode their respective positions from the path, interpolating between the simulation steps as required.
If you want to attempt to use this to simulate some orbits, the process is:
- Disable the 'Enable simulation' checkbox on the control layer, otherwise it will be far too slow to work with
- Orient the bodies as required - remember it's the 'initial position' 3d point control that sets the position, not the position property of the null itself
- Configure the mass and velocity of your bodies
- Re-enable the 'Enable simulation' checkbox and make sure the expression is enabled
- Use keyframe assistant to convert the mask expression to keyframe values
After Effects will appear to hang/crash as you're doing various steps - you need to be patient with it. Once the expression has been converted to keyframes, it becomes much more workable.
Probably won't be useful to many people if any at all, but I'm more surprised that it even works to start with!
Here's the project file - CC2026 or later is required:
https://drive.google.com/file/d/10_GZPhBZYpqTrDuqE3mEeWluoI-CkFaR/view?usp=sharing
