Hey guys!, we’ll I’ve been personally talking to Jacques Lucke and he has been helping me understand Animation Nodes and I’m committed to share everything I learn from him in little tutorials that will help us out building a community of users that will benefit from this powerful addon.
Below there is the written tutorial as well.
So what we’re looking to achieve with this exercise is an animation setup to make the worlds in this solar system spin around themselves and also orbit around the sun but also be able to control it’s scale and distance from the sun.
To do that we will use Matrices,
A matrix is an ordered array of numbers (at least in this case), and each transform in blender is a Matrix, and matrices can be combined and the order you combine them can be used to achieve different transformations.
So first we’ll open our add menu (Shift+A) and go to Object > Matrix Output to get this little node.
This node is the one that will pass the matrices that we mix up to the object you have in your scene, in this case the sphere/planet, and in this case we’ll use Jupiter, so with the picker it’ll pick the object you already have selected or you can write the name in the textbox and it’ll show you a list (handy!)
We’ll continue again to add a node to combine multiple matrices and you can either go to the add menu (Shift+A) or you could just do a search (Ctrl+A) and search for the name of the node.
Now we need to add matrices to combine, first i’ll add the Scale Matrix
And when you connect it to the Combine Matrices node, you’ll get a Create Matrix List just in between because the Combine Matrices needs a list of multiple matrices.
So up to here we have a Scale Matrix, a Rotation Matrix, a Translation Matrix and a Rotation Matrix, in that order and they should be connected to the Create Matrix List node in that order, or else you’ll get different results.
So now if you try out each property, you’ll see the planet moving in space, make sure you set both nodes of Rotation Matrix to “Z” and that you use the “X” in the translation matrix.
Then after you’ve done that, we need to make this move on it’s own, that’s sort of what animation nodes is all about.
To do that, we’ll use the Time Info node, what this node does is it gives you the value of the frame the playhead is standing in, so if you’re in frame 7 it will output a 7, this is great because we have an increasing number we can do to trigger anything.
So to connect it to the rotations which are the attributes that will work on their own, first add a “degree to radian” node, that way, each frame will be 1 degree of rotation, and that means that an entire 360° rotation will be accomplished in 360 frames.
And so everything makes sense now.
That’s probably too slow, or too fast, and so you want to have an attribute to control the speed of both rotations separatelly, to do that add a Math node before each rotation node, and keep it in multiply, so by default speed is 1. if you pump it up to two, you’ll get 360° in just 180 frames, and so on.
So right now you have you’r automated rotation planet thingy working, pretty cool huh?.
Not that cool, it’d be cooler if we could use this setup in several different objects and have different values for each one, because you know, some planets are bigger, others smaller some move faster, and some move slower.
To do that we’ll create a Subprogram called Group:
And so a group is a subprogram that can be reused, it works similar to groups in other nodes setups in blender but it isn’t contained in a sub node, it just gets a color.
Connect the inputs from the rotation matrices each to one of the “new parameter” socket in the group, and give your group a name.
With scale we want to do something slightly different, because if i connect the vector attribute from it it will output 3 values to control, and all in all i just want to have 1 value to handle the overall scale of the planet,
So add a Vector from Value node in between that way, whatever number you input will give that number to X Y Z in the Scale Matrix… remember to call that one “Size” in the Group Input node.
Different case, in the Translation Matrix you don’t want to handle the 3 values, but you just want to move X, so get a Combine Vector node, and just connect X and call that one “Distance” because this will control the distance from the center of the world.
Now you want to create the Invoke node to test stuff out, remember when you start connecting stuff to the group, all these attributes will be unusable until you invoke the SubProgram:
And you’ll get this node right here with all the properties you’ve created.
We’re just missing one last one that will give us the ability to apply this animation setup to other different objects: so go to the last node, the Matrix Output node and connect “Object” to New Parameter in the Group Inputs
There you go, so this node, this very special node was made by yourself, and now you can apply whatever parameter and it will work, and also you can duplicate as much as you want for each planet that you want orbiting in your scene:
So this it what I did!
Sooooo… you want to add a moon?…. do this:
Found it useful?, something wasn’t clear?, made something better out of it?
Then leave a comment!, and happy blending!