I am trying to make the skeleton to move relative to the bones that are touching the floor using animation nodes.

What I did is calculate the difference between the current and previous positions of the bones and apply the difference of the lowest bone to the root bone.

enter image description here

Here is the blend file:

  • $\begingroup$ Not entirely sure what you want to achieve here. Can you elaborate? What should the end result be? $\endgroup$
    – Omar Emara
    Aug 25, 2018 at 19:21
  • $\begingroup$ @OmarAhmad when the animation played, the lowest bone should stay stationary and the root bone displaced relative to the lowest. The result should be displaying actual movement of the skeleton like it is walking. $\endgroup$
    – Denis
    Aug 25, 2018 at 19:29
  • $\begingroup$ Is the "lowest" bone a fixed bone? Or is it chosen dynamically as the bone with the lowest z location? $\endgroup$
    – Omar Emara
    Aug 25, 2018 at 19:40
  • $\begingroup$ @OmarAhmad It is dynamically chosen by the lowest z location $\endgroup$
    – Denis
    Aug 25, 2018 at 19:42

1 Answer 1


Always Touch The Floor

In this section, we shall position the root bone of the armature such that the lowest bone is touching the floor. Since the ankle/heel bone's local z axis is perpendicular to the global z axis, the head and tail z locations are identical and since the tip/tail of the toe bone will be the last bone touching the floor, to identify the lowest bone, we shall use the location of the tail instead of the head.

First, we compute the index of the bone with the lowest tail z value by using numpy's argmin() function, the input of the function should be a memory view of the values computed using the asMemoryView() method, so the expression becomes:


To get the minimum value itself, we simply get the value at that output index as follows:


Now, we should move the armature along the global z axis—By moving the root bone Spine—to make the lowest bone touch the floor, this is done by subtracting the lowest z value from the z value of the root and assign the new location by using the expression:

object.pose.bones["spine"].matrix.translation = location

Set Root

The result is the lowest bone always touching the floor which concludes this section.

Touch The Floor

Root Displacement

In this section, we shall displace the armature—By displacing the root/spine bone—based on the displacement of the bone that is touching the floor, that is, the lowest bone which we know from the foregoing section. To compute the displacement of all bones, we shall use the method I described in this question. Note, however, that all bones are children of the root bone and thus any displacement in the root bone causes further displacement on all the children, so, to get the actual displacement of the bones without the displacement caused by the root, we should add the displacement of the root to the displacement of the bones. Now that we have the displacement of all bones, we can get the displacement of the lowest bone using the index we already computed in the foregoing section.


Notice that the Get List Element node with zero index is the one that gets the the position of the root bone and the subtract gets the displacement, also notice how we add that displacement to the displacement of the bones.

Now, all we have to do is displace the root by the displacement we computed by adding it to its original position (Or subtracting depending on how we computed the displacement, which is the case here). Note that we already have the z location of the root from the foregoing section, so we just need the x and y locations. One last thing to do is reset the location of the root bone to some initial location of your choice at the initial frame, zero location for instance. This is done by checking if the current frame is the start frame and use a Switch node to switch between the current and the initial location.

Set Root Location

And the result is as you might expect.

Result Animation

Blend file for study:

  • $\begingroup$ Currently I can't test this, but the displacement should be on the root bone instead of the armature. $\endgroup$
    – Denis
    Aug 25, 2018 at 21:20
  • $\begingroup$ @Denis By root I assume you mean the "spine" which is the parent of all bones, thus applying the transformation on the object is exactly the same as applying the transformation on the root. Am I mistaken? $\endgroup$
    – Omar Emara
    Aug 25, 2018 at 21:27
  • $\begingroup$ Yes, the displacement is applied on the spine bone. The movement of the skeleton should be inside of the Armature space, because the animation is used outside of blender where the origin of the animation is fixed. $\endgroup$
    – Denis
    Aug 25, 2018 at 21:40
  • $\begingroup$ @Denis Added another method to fit your need. $\endgroup$
    – Omar Emara
    Aug 26, 2018 at 9:08
  • $\begingroup$ This method is not going to work for me, do you think its possible fix the spine bone displacement in the node tree I created? $\endgroup$
    – Denis
    Aug 26, 2018 at 19:04

You must log in to answer this question.

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