Search Unity

Get velocities (linear and angular) from animation at each frame

Discussion in 'Animation' started by vicenziano, Dec 8, 2021.

  1. vicenziano

    vicenziano

    Joined:
    Sep 11, 2018
    Posts:
    4
    Hi, guys!

    I've worked with Unity for some years, so I have lots of familiarity with it, but I cannot seem to solve this. I have a bunch of mocap files that were imported as animations, which is all fine and dandy. The problem is that I cannot seem to figure out a way to get the velocities, both linear and angular, at each frame.

    Now, I designed a script that uses the curve bindings to get the position and rotation of the root note at each frame, but it is not optimal, since I had to code a script in python to interpret all this information and translate it into the velocities. I know that when running I can access the velocities by the animator component's parameters "angularVelocity" and "velocity", but I still couldn't figure out a way to do this without running all the mocap data, which would take a while. Is there any way to do it without playing every animation?

    Thanks!