FORUMS: list search recent posts

# Running a Simple Simulation in AE

FAQ   •   VIEW ALL
 Running a Simple Simulation in AE on Jun 25, 2014 at 7:12:48 am

When I was a kid I used to use high school math and simple laws of force, gravity, mass, acceleration and velocity to simulate a bunch of bodies orbiting in mutual gravitational attraction. The objects would slingshot around and do all kinds of unpredictable things.

Is this possible in After Effects using expressions? It's obviously possible for certain physics engine plugins to do that and far beyond, but they seem to run everything in advance and load every object with key frames at every frame. I think. Is it possible to do something simpler in AE?

For example, I'd like to keep an acceleration vector and at every frame I'd like to use it to update a velocity vector (by adding the two), and then use that to update a position (by adding the two). It just looks like AE doesn't work that way, and I have to be able to express everything as a function of time. I don't want to pre-plan all the functions f(t), I just want it to crank along from state to state where each new state arises from applying a simple set of rules to the current state. Possible?

 Re: Running a Simple Simulation in AEon Jun 25, 2014 at 8:40:56 am

Expressions have no way to pass any information from one frame to the next, so if your calculation depends on a previous calculation, you need to re-create the previous value, either by setting your calculation up as a function of time, or you can use the brute-force iteration method of starting at frame zero and looping through your calculation until you get to the current frame.

Dan

 Re: unning a Simple Simulation in AEon Jun 25, 2014 at 1:43:53 pm

Is this the sort of thing that could be handled in a script that keeps track of every object's motion and sets key frames for it at every frame?

 Re: unning a Simple Simulation in AEon Jun 25, 2014 at 4:03:56 pm

That should work. You have the advantage of persistent variables, but the disadvantage of it being not as easy to tweak the parameters.

Dan

 Re: unning a Simple Simulation in AEon Jun 25, 2014 at 4:05:29 pm

thanks

 Re: unning a Simple Simulation in AEon Jun 27, 2014 at 6:22:43 am

Take a look at Newton:

http://aescripts.com/newton/