# Parent Grouped Objects in Animation Nodes

I have a simple scene featuring a cell-fractured Cube object with the following Animation Nodes setup, based on Jacques Lucke's tutorial here.

I was wondering how it would be possible to effectively parent all of the individual fractured pieces to an animated Empty object and have them rotate as if the cube was a whole (see the .gif for reference, below), whilst retaining the individual piece matrix transformations defined within the AN setup?

This is using Animation Nodes 2.1 for Blender 2.79.

Thanks in advance! :)

UPDATE:

Using Omar's suggestions, I have been able to parent the Fracture Group objects to the Animated Empty object by multiplying the Animated Empty's matrix input by the manually generated ID Key initial transform matrices of objects in the Fracture Group (see below).

I would also like to parent the Sphere Empty object to the Animated Empty. I have been able to do this again by manually creating an ID Key of the Sphere Empty's initial transforms, however, I was hoping that there would be a more automated method, rather than having to generate ID Key's by hand for each object I'd like to parent. Below are several attempts at automating this approach. @OmarAhmad, the first .gif below is a reference of what I'm trying to achieve, although obviously, this one uses the manually created ID Key's.

Reference:

Unsuccessful Attempts without ID Keys:

Using World-Generated Matrices:

Using Object Transforms:

• Are you just looking to parent some objects to an empty? – Omar Emara Apr 8 '19 at 12:12
• @OmarAhmad Possibly, parenting the fractured objects to an animated empty with CTRL+P doesn't seem to work, I assume due to the fact that the AN node-tree overwrites any other custom object transforms? My end goal is to have the Object Controller Falloff Empty expand, shrinking the fractured pieces as it does, whilst the whole mass rotates around a second Empty object, which is hand-animated (as is shown in the gif, except with the solid cube swapped out for the fractured objects). A bit complicated to explain! Let me know if you need any further clarification. :) – Hexbob6 Apr 9 '19 at 20:38

## 1 Answer

Parenting in essence can be implemented as a simple matrix multiplication. For instance, give an empty and an object with a certain initial transformation. In order to parent the object to the empty, we simply multiply its initial transforms by the transforms of the empty as follows:

So, to answer your question. All you have to do is multiply the output matrices to the transforms of the empty.

• Ah so simple, can't believe I missed it! In the instance of parenting the Sphere Empty in my example to the animated Empty, is there a way to grab the 'current transforms' on the fly, or would I have to create a custom ID key manually each time? Using the generated Initial Transforms from the node seems to reset the LocRotScale of the Sphere Empty, as though it had just been added to the scene. – Hexbob6 Apr 10 '19 at 20:52
• @Hexbob6 I used the ID key just for demonstration. You may use the object's transforms directly, Just make sure you don't trap yourself in an infinite loop. – Omar Emara Apr 10 '19 at 21:23
• Would you mind explaining further on using the object transforms directly? Using the Object Matrix Input node's World output to multiply the Sphere Empty and Animated Empty's matrices together causes the Sphere Empty to orbit the Animated Empty at an exponentially increasing rate when the animation is played (the infinite loop you were talking about?). I have also been unable to achieve the desired effect with the Object Transforms input/output nodes; I have been able to parent the location, but I can't make the Sphere Empty rotate around the Animated Empty, only on its local axis. – Hexbob6 Apr 12 '19 at 21:09
• @Hexbob6 Notice that the order of multiplication matters. The fact that the empty rotates around the local axis tells me your order of multiplication is wrong, try flipping the order. I am bit confused on why you want to transform the Sphere Empty. isn't this empty your controller object? – Omar Emara Apr 12 '19 at 21:33
• Apologies for the delayed reply, busy week! I have added an update at the bottom of my original question with further descriptions and tests. Both the Sphere Empty (Object Controller) and Fractured Cube group should be parented to the Animated Empty. The plan is to have the Sphere Empty eventually expand, causing the Fractured Cube pieces to gradually scale down, all while moving relative to the Animated Empty- although this additional scaling animation is beyond the scope of my parenting question. :) – Hexbob6 Apr 19 '19 at 21:47