I want to make an effect of a wall of hexagons (just cubes) move in and out at different points simultaneously, almost like if it had an ocean modifier, or could textrue displacement on a plane, but i want the objects to be individual. doing this with the particle system can be annoying at times to where i have not gotten an acceptable result. I saw a demo on youtube where someone used a random object to push on the cubes with a proximity node in the animation nodes part of blender. I just downloaded animation nodes recently and the nodes he used are no longer in the animation tree, probably because it's been 2 years since the video was made. anyone know how to create the proximity effect with the (2017) current animation node set up?
Without using animation nodes you can create a subdivided plane and make it the parent of a cube, then enable dupliverts on the plane to have an instance of the cube at each vertex. As you deform the plane the duplicates will move with each vertex.
To your question of using animation nodes - A Grid Mesh node will give you an array of vertices that you can use for the location of duplicates, while an Object Instancer node will make the duplicates, then use a subprogram to adjust each duplicate. You create a subprogram to be able to repeat a node setup for each item in a list.
- Add a loop subprogram - A->Subprograms->Loop
- On the Loop Input node add two iterators, one as an object list, the other a vector list.
- Add an invoke node with A->Subprograms->My Loop (unless you renamed it), the Invoke Subprogram node will have input sockets for each iterator you have added.
- Connect the output of the object instancer to the object list input of the Invoke node.
- Connect the vertices from the Grid Mesh to the vector list input of the Invoke node.
- Add an Object Transforms Output node.
- Enable the location checkboxes to get an input socket for location.
- Connect the Loop Input object to the object input of the Transforms Output node.
- Connect the vector from the Loop Input to the location input of the Transforms Output node.
Now that you have the duplicates in place you connect in other nodes to alter the location. In this example I use separate and combine vector nodes and add in a number wiggle to alter the z location.
To get the distance between two objects there is a distance node -
Zach Hixson has recently started a tutorial series for animation nodes, you may want to have a look at his playlist
(unnecessary) complicated method
which allows control using mainly nodes.
- Create a cube with dimensions of (1, 1, 1).
- Add an animation nodes tree. Add two Integers (X, Y) which we'll use to control the size of the grid (amount of cubes). Multiply the two values to get the needed amount of cubes and connect the result to an Object Instancer, set to the Cube. Add a subprogram taking the Object Instancer List, the X integer and a float (cube size) as input.
- In the subprogram control the object's transforms (Object Transforms Output) by connecting the cube size to the objects scale and creating the Location Vector with a Combine Vector node. The X Position is the Modulo of the Index and the X / width parameter. The Y Position is the Result of floor dividing index and x.
This is the resulting node setup.
The setup creates a cube grid.
Create a wave controler object.
- Create an empty, add a custom property (waveGraph) to it. We'll keyframe this property and create the wave shape with keys in the graph editor.
- Add a property to the subprogram for our special controler empty.
- Next, get the distance of the empty and each cube in the subprogram with the following nodes.
- Disable snapping in the graph editor and key the empty's special property (waveGraph). Get the FCurve from the controler empty. (FCurves from Object > Get List Element > Evaluate FCurve). Set the Evaluate Fcurve node to Absolute Frames. Use the sum of the Vector Distance and the empty's Z Location as the Frame Input. Connect the output of the Evaluate Fcurve node to each cubes Z Positions input.
- Now you can shape the cubes by moving the empty and creating the wave shape with the FCurve on it's waveGraph property.
Various easily controled shapes are possible.