I want to affect some shapekeys based on the speed on the Z axis of a set of objects that are being moved inside a loop.
This has been my approach...
Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It only takes a minute to sign up.
Sign up to join this communityI want to affect some shapekeys based on the speed on the Z axis of a set of objects that are being moved inside a loop.
This has been my approach...
You need two things to make the Frame Offset work in a Object Transforms Input node:
You have to disable "Use Current Transforms" in the advanced node Settings.
For future releases of AN it is already implemented that the Frame socket will only be available when Use Current Transforms is disabled.
If your animation is not made with keyframes but with this addon you will need to calculate the position of the object twice in each execution (for the current frame and the frame before). Then you have to calculate the distance between both points like you did in your example. You should create a subprogram (a Group in this case) in order to minimize the amount of nodes needed.
I think the answer of Jacques Lucke is the right one for the precise question. So maybe should consider answered.
However, in further comments you say that the particular case is a mesh poly center deformed with modifiers etc. So indirect deformation or simulation, where we do not have all frames stored somewhere. Kind of the extreme opposite case of a simple animation.
There are several cases, depending on how animation is done:
All these have the enough data for all frames already stored or computable, due to keyframes. The above method should be applied, or with some minor variations. (the answer of Jacques Lucke)
Get the mesh data node with NO World space and further compose a matrix out of the Object transforms loc rot scale to get the right position of the mesh.
When you have modifiers (ocean), armatures or simulation (cloth etc), the most efficient way to "write down" certain vector data for all frames is working with particles. This allows for large data to be "stored" with no significant slowness.
Here's how it's done: Particle Trails part 2 and a simpler example Particle Trails part 1
(don't be fooled by the particle trail splines, that is just one possible use)
in this videos I use following:
match the particle count to frames or other logic
instance the single vert emitter to the desired locations, verts, poly centers etc
I use an Instanced emitter to have more control. So I can use precisely the centers of poly or the half of edges or only some of them , or even animate adding them one by one etc.
You can also use such an example Instance trail where you can extract the data out of any of those "trail" objects. But is somewhat less efficient with large data.
Again, those objects are not dupliframes or so, but instances with a tweaked action NLA strip to have more control and eventually extra modify them.
There are direct ways in Animation Nodes to store such data or lists in object properties or so. I have tried such, but I cannot recommend them. The setup is tedious and it's kind of a black box, you don't have all things in sight.