1
$\begingroup$

I am trying to understand how exactly parented bones are rotated in blender.

Consider the following hierarchy: Bone1 -> Bone2 -> Bone3 -> Bone4 -> Bone5

If i were to rotate Bone2, how will blender rotate it & it's children bones(Bone3, Bone4, Bone5)? I'd assume that Blender does the following:

  1. Set pivot point of Bone2 to the bones local position, Rotate Bone2
  2. Set pivot point of Bone3 to (Bone2.localPos + Bone3.localPos) Rotate Bone3
  3. Set pivot point of Bone4 to (Bone2.localPos + Bone3.localPos + Bone4.localPos) Rotate bone4
  4. Set pivot point of Bone5 to (Bone2.localPos + Bone3.localPos + Bone4.localPos + Bone5.localPos) rotate bone5

And from what i understand the local position of a bone is calculated the following way:

Bone.localPos = Bone.pos - Bone.parent.pos

If the bone has no parent then it's just the bones position

An example with actual position values:

Now even more explicitly:

Assume that the bones have the following global positions:

Bone1: (50, 20, -25)
Bone2: (35, -15, 20)
Bone3: (-10, -20, 50)
Bone4: (-35, 20, 40)
Bone5: (15, 25, 10)

The local positions would be:

Bone1Local = (50, 20, -25)
Bone2Local = (-15, -35, 45)
Bone3Local = (-45, -5, 30)
Bone4Local = (-25, 40, -10)
Bone5Local = (50, 5, -30)

The pivot points when Bone2 is rotated would be the following:

Bone2: (-15, -35, 45) // bone2Local
Bone3: (-60, -40, 75) // bone2Local + bone3Local
Bone4: (-85, 0, 65) // bone2Local + bone3Local + bone4Local
Bone5: (-35, 5, 35) // bone2Local + bone3Local + bone4Local + bone5Local

If this is not how blender rotates bones, an explanation how it actually works would be much appreciated, if it is please just confirm that my understanding of it is correct :)

Blend file:

$\endgroup$
4
  • $\begingroup$ 1) these "theoretical" informations might be "enough" but if you want to make it easy for us, who want to help, insert sketches/screenshots so we "see" what the result is, and show us, what result you expect 2) why should you make it easy for us and invest more time? because you want help and we help for free and by this you will attract more people to your question and more people are willing to help 3) a blend file is "the cherry on top" because we can download it and immediately play around and search for the solution $\endgroup$
    – Chris
    Commented Nov 29, 2021 at 2:56
  • $\begingroup$ @Chris I have included the blend file, as for what i expect / what the result it doesn't really matter in my case as everything works as it should in the blender file. But just from looking at how the bones move, i still can't 100% understand exactly how blender rotates & set pivot points for each bone when a parented bone is rotated. I need to know this information because im importing animated models made in blender in my engine and i need to set origins/pivot points for each bone before i rotate it, and for it to look exactly like in blender i need to know how blender sets them. $\endgroup$
    – Suic
    Commented Nov 29, 2021 at 3:22
  • $\begingroup$ but if it works - as you expect....you shouldn't ask ;) ask, if it doesn't work as you expect. Doesn't make sense this way...does it!? $\endgroup$
    – Chris
    Commented Nov 29, 2021 at 3:30
  • $\begingroup$ I ask because i don't know how it works in blender, sure i see that it works but how exactly does blender do it? and i need to know before i can start importing animations made in blender into my engine. $\endgroup$
    – Suic
    Commented Nov 29, 2021 at 3:32

2 Answers 2

1
$\begingroup$

We can make the exact armature you'd like to use as an example. It looks like this:

enter image description here

However, you didn't specify in what axis you wanted to rotate bone2. That would let you actually do some math and compare with what you see.

The pivot point for all bones, in your example, where we rotate bone 2, is world space 35,-15,20. That is the location of the head of bone 2. Anything that happens, to any bone in this unconstrained armature, as a result of the rotation of bone 2, will be a rotation about that point. We can see this. Let's duplicate the armature:

enter image description here

On the left, I have rotated your Bone2 -45 degrees in my view axis. On the right, I have the same bone locations, but all bones are unparented (see outliner, and forgive me for not fixing names); in this view, I snapped the cursor to the location of your Bone2, then rotated it and all bones that would have been parented to it, by -45 degrees in the view axis, about the cursor.

If we want to convert the location of Bone2's head from a world space position to a position local to one of those bones, we can (it depends on the axes of the bones; you're making some unspecified assumptions about the axes.) But there is no reason to do that, and it would be misleading. The origin of the inherited rotation is not stored as some local space number. While those armatures that I showed have the same final rotation, they wouldn't interpolate from rest to that position in the same way. No object or bone contains a history of rotations and origins of those rotations; they only ever contain a single rotation, about their own (untransformed) origin. The transformation of the parent is inherited by the children only via the parenting relationship. The child does not ever know where the parent's origin is.

If for some reason, I feel the need to know where the origin of this particular inherited rotation is, that is to say, I need to know the local space position of the head of Bone2, it's possible. I can give a bone a copy position constraint, world->world, targeting Bone2, then apply as visual transform. The local space position will be the transform the bone gets:

enter image description here

Here, we can see on the sidebar the Bone3 local space position of Bone2. As I said, this value depends on the axes of Bone3.

If you want to know more about how parenting works, you first have to understand how objects are transformed. I would recommend starting at https://en.wikipedia.org/wiki/Transformation_matrix . The parent has a matrix representing its transform. The child inherits the parent's transform by multiplying its own transform with that of its parent. If the child has not been transformed, then its transform is its parent's transform, the exact same transform, but in matrix form, not keyframe triplets.

I would also strongly recommend https://gamemath.com/book/intro.html where you can find a professional primer on 3D math (including understanding 3D transformations) that the authors have chosen to share for free online. I have a physical copy and have found it invaluable. That's longer than Wikipedia, but that's a good thing, not a bad thing.

$\endgroup$
7
  • $\begingroup$ > The origin of the inherited rotation is not stored as some local space number How exactly does inheriting the rotation from the parent work? Also i believe i do have somewhat of an understanding of transformation matrices as i've used them before, but i still can't wrap my head around how inheriting rotations/origins work in blender. Lets look at an actual example in my blend file that i included. If i rotated the Left leg bone in the x axis by 0.5(45 degrees i guess) how are it's children bones rotated(knee, foot, toe)? $\endgroup$
    – Suic
    Commented Nov 30, 2021 at 15:11
  • $\begingroup$ What i thought would happen is that The leg bone is rotated by 45 degrees in the x axis and the rotation origin would just be the local location of the bone Then knee, foot, toe are also rotated by 45 degrees in the x axis(I am not sure about their rotation origins/pivot points tho) which i need to figure out (perhaps even the fact that all 4 bones are rotated 45 degrees in the x axis is wrong, i'm not sure) but i need to figure out how it works so i could calculate the rotation origins for each bone which would allow me to mimic the rotation in my own program. $\endgroup$
    – Suic
    Commented Nov 30, 2021 at 15:15
  • 1
    $\begingroup$ "The origin of the inherited rotation is not stored as some local space number How exactly does inheriting the rotation from the parent work?" It is stored as a rotation on the parent, not on the child. This site isn't good for comment-conversations, but your example is the same as above: the children rotate 45 degrees in world X about leg's head. $\endgroup$
    – Nathan
    Commented Nov 30, 2021 at 16:23
  • $\begingroup$ I agree that comment-conversations aren't really ideal(I'd love to just create a chat room to follow up on this conversation but it believe it requires 100 reputation which i don't unfortunately have) "but your example is the same as above: the children rotate 45 degrees in world X about leg's head" So that means the 3 children rotate 45 degrees in the x axis about leg's location(which is the head afaik) But if the leg is first rotated, then the location of it changes(no?) so do the 3 children use the location of the leg after leg has been rotated? if that makes sense $\endgroup$
    – Suic
    Commented Nov 30, 2021 at 21:02
  • $\begingroup$ Rotating leg does not change its location (its head.) The origin of rotation remains the same; rotating a point at the origin about the origin does nothing. Rotating the parent of leg changes its world space location, which changes the matrix that leg inherits, which changes the matrix that any of leg's children inherit (in effect, changing the center of any rotation they're inheriting from leg.) $\endgroup$
    – Nathan
    Commented Nov 30, 2021 at 21:21
2
$\begingroup$

If your bones doesn't have any constraints or locked axis, if the parent bone will rotate (in pose mode) around its head, every children will move with it. So it works exactly the same as if you would parent to objects to each other. Just the objects take their pivot point, and bones will take their head as rotation point.

Same is for movement, if the bone can be moved.

In your case: the rootjoint is parent of all, so if you rotate it, your whole model + armature rotates arount its head.

$\endgroup$
5
  • $\begingroup$ I appreciate the answer, but it seems like my question wasn't entirely clear because i already know that when a parent bone is moved, it's children move with it. My question was mostly about what the pivot points of each bone are when they're moved by a parent bone. In my case look at 'Left leg' it has an hierarchy of: Left leg -> Left knee -> Left foot -> Left toe Lets say i moved the Left leg bone, what are the pivot points of Left knee, Left foot, Left toe? $\endgroup$
    – Suic
    Commented Nov 29, 2021 at 3:44
  • 2
    $\begingroup$ the pivot point is always the head of the bone. so if you move the left bone, in world coordinates, the pivot points of all children are the pivot points before plus the movement of the left leg. in local coordinates they remain the same. $\endgroup$
    – Chris
    Commented Nov 29, 2021 at 4:04
  • $\begingroup$ So if i were to move the left leg the pivot point of the foot would be the pivot point of the foot plus the movement of the left leg? But wouldn't that mean that only translations affect the pivot points of child bones? As rotation doesn't really affect the pivot point afaik $\endgroup$
    – Suic
    Commented Nov 29, 2021 at 4:15
  • 2
    $\begingroup$ it depends ;) i will make a short video for it...with words, it's hard to explain. The pivot point of each bone (locally) will never change it's position. If you rotate a bone, it will alway rotate around its pivot point. But of course, in world coordinates, if you rotate a parent bone, the world coordinates of the child bones will change. $\endgroup$
    – Chris
    Commented Nov 29, 2021 at 4:21
  • $\begingroup$ Yeah your right, when i rotate the bone the world coordinates of the bones affected changes, so is the 'change' of world coordinates after the rotation what gets added to the location of the child bones?(which defines the pivot point) anyway i will wait for the short video and maybe i'll understand it better then $\endgroup$
    – Suic
    Commented Nov 29, 2021 at 9:38

You must log in to answer this question.

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