# Animation Nodes and Velocity

VELOCITY Animation Nodes have been very useful for me so far, but I am stumped as to how I can use an object or particle's velocity to influence other properties (like color, rotation, etc.). There's plenty of documentation out there on how to calculate one axis, but I've yet to see how to accomplish this with objects that don't move in a straight line. Any ideas?

• How are you getting the object velocity? Jun 6, 2018 at 16:14
• I've not gotten it so far. That's why I'm looking to see if anyone else has figured it out. If it's not known, it would be great if someone could help make it a reality. Jun 6, 2018 at 17:10

You can get the velocity of particles from the Particle Data Node (The velocity output is hidden by default).

For objects, if its location is described by a parametric path, then the velocity is described by the "gradient" of the parametric equation (You will need some knowledge in differential calculus to get that, however, you may use a finite method that I shall describe in the following implementation).

Moreover, If the object is animated using blender's animation system, and thus described by F-Curves, then a discrete finite method can be used to compute the velocity. First, get the F-Curves of the object and get its info.

Then, find the F-Curves that represents the location of the objects by searching for the path location, then sort the indices based on their F-Curve data index such that they become in the order x, y, z. Then get the F-Curves at those indices.

Then, create a function that computes (Approximates) the derivative at some given time with a given epsilon. The function can be a Central Finite Difference Method. Notice that the function is the F-Curve.

Now, loop over the x, y, z F-Curves and compute their derivatives and compose a vector from the result, this vector is the velocity and its magnitude is the speed.