4
$\begingroup$

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...

enter image description hereBut something is failing

$\endgroup$
5
  • $\begingroup$ related: blender.stackexchange.com/questions/29007/… $\endgroup$
    – p2or
    Nov 25, 2015 at 10:36
  • $\begingroup$ I can´t find the object info node on v 1.5 $\endgroup$ Nov 25, 2015 at 10:45
  • $\begingroup$ Object > Transforms Input works for me $\endgroup$
    – p2or
    Nov 25, 2015 at 10:50
  • 1
    $\begingroup$ I have used the same node and it seems that the velocity sockets has been removed on the later version. $\endgroup$ Nov 25, 2015 at 10:59
  • $\begingroup$ Yes the Velocity sockets have been removed because it was to unflexible and they cluttered the code a lot. They had the same limitations I mention in my answer below. $\endgroup$ Nov 25, 2015 at 11:12

2 Answers 2

5
$\begingroup$

You need two things to make the Frame Offset work in a Object Transforms Input node:

  1. The Animation of the object must be created using normal keyframes (fcurves)
  2. You have to disable "Use Current Transforms" in the advanced node Settings. enter image description here

    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.

$\endgroup$
6
  • $\begingroup$ Well, the thing is that objects are animated based on the polygons centers of another object, which has an ocean modifier. So it seems that the workaround of calculating positions won´t work as long as you can only access mesh data from the actual frame. So I guess that it´s impossible right now to do this type of things with AN. $\endgroup$ Nov 25, 2015 at 11:16
  • $\begingroup$ Hm yes. It is impossible to do this in one step. In theory you can bake the object positions into keyframes in the first step and then use object transforms input nodes to get the velocity in a second step.... $\endgroup$ Nov 25, 2015 at 11:20
  • $\begingroup$ It seems that could work. I´ll give it a try. Is there any plans to implement this on the near future or is it technically complicated? $\endgroup$ Nov 25, 2015 at 11:22
  • $\begingroup$ It is very complicated to get the mesh in a different frame. I don't think that this will happen. $\endgroup$ Nov 25, 2015 at 11:24
  • $\begingroup$ The other possible approach is to use the data baked by the Ocean modfifer. But the thing is that this data is stored on .exr format with one image per frame so I guess that this difficult the task even, because you have to load a different .exr file for each frame calculation and after that you have to figure out which pixel you have to take into account to calculate the displacement of each object. Or even worse you have to calculate a mean average amongst the nearest pixels to determine the height, which is now away far from my skills. So I guess that this project should be abandoned. $\endgroup$ Nov 26, 2015 at 8:25
0
$\begingroup$

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:

  1. The basic Animated keyframes, animated on a spline (again with keyframes), or animated by nodes.

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)

  1. When you need mesh data or so, but only have keyframes on the object. For lots of cases it's indirect but computable.

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.

  1. 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:

    • make a single vert object, set as particle emitter
    • particle settings: no gravity, no Normal etc Velocity
    • match the particle count to frames or other logic

    • instance the single vert emitter to the desired locations, verts, poly centers etc

    • use particle nodes to read this data in whatever way

    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.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .