ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Inverse kinematics in 3D

FAQ   •   VIEW ALL
 Inverse kinematics in 3D on Mar 3, 2020 at 7:22:49 pm

Has anyone written or know where one could find an AE expression for inverse kinematics in 3D?

 Re: Inverse kinematics in 3Don Mar 3, 2020 at 7:57:05 pm

Not really, AE isn't (officially) capable of calculating and distributing multiple rotation values at once which you need to do for 3D rotation calculations, so you would have to do it on orientation which wouldn't be optimal, given it's based on shortest-distance calculations to itself rather than world.

You could maybe cheat a lookAt expression on the orientation of an upper and lower limb and use an elbow and wrist controllers as targets, but it wouldn't be true IK.

Alex Printz
Mograph Designer

 Re: Inverse kinematics in 3Don Mar 3, 2020 at 8:36:30 pm

Hi, Alex!
I'm not sure I understand what you mean by "calculating and distributing multiple rotation values at once".

I'm far from an expert in trigonometry so I have not yet tried to implement this myself but it's hard for me to believe that this is not possible with AE expressions. I mean, if you can do it in 2D why wouldn't you be able (with a bit more math) do it in 3D? Can you explain a bit more why you think this is not achievable in AE?

Thank you!

 Re: Inverse kinematics in 3Don Mar 3, 2020 at 8:58:22 pm

Because after effects 3D rotations are 3 different expressions: X, Y, and Z, while orientation calculations are matrix-based mathematics.

https://en.wikipedia.org/wiki/Rotation_matrix

After Effects expressions calculate independently one at a time; so an X-rotation is the first thing solved, then Y, then Z, etc, and the only thing that is shared is the final value.

Matrix calculations need to be preformed all at once and are interdependent, so if you solve for one and apply it, it will affect the others. They have to all be done at once. 2D rotation is a single rotation, so it's much easier to solve for.

In the past I've built a 3D-based null that can steal the properties of other layers before, and the only way to solve for 3D rotation is to lock the rotation properties and instead use orientation, which is again going to be based on shortest path orientations and will (probably) give some incorrect results since orientation is not world-based, but object based.

There might be a way to calculate the orientation back to the worldspace through a toWorldVec calculation, but that's a bit beyond me off the top of my head.

Alex Printz
Mograph Designer