1
$\begingroup$

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?

$\endgroup$
  • $\begingroup$ Have you seen this? youtube.com/watch?v=D-y8REUdg6I $\endgroup$ – Scott Milner Mar 5 '17 at 3:24
  • $\begingroup$ I have, but sadly he is using a music node, like the cubes are reacting to sound, i need it to be where i can control the waves, if at least partially. But I appreciate your effort! $\endgroup$ – Robert Dold Mar 5 '17 at 3:28
2
$\begingroup$

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.

using dupliverts

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.

  1. Add a loop subprogram - A->Subprograms->Loop
  2. On the Loop Input node add two iterators, one as an object list, the other a vector list.
  3. 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.
  4. Connect the output of the object instancer to the object list input of the Invoke node.
  5. Connect the vertices from the Grid Mesh to the vector list input of the Invoke node.
  6. Add an Object Transforms Output node.
  7. Enable the location checkboxes to get an input socket for location.
  8. Connect the Loop Input object to the object input of the Transforms Output node.
  9. 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.

animation nodes tree

To get the distance between two objects there is a distance node -

calculate distance

Zach Hixson has recently started a tutorial series for animation nodes, you may want to have a look at his playlist

$\endgroup$
1
$\begingroup$

Sambler's answer works well and is quickly to execute. Here is a slighty different

(unnecessary) complicated method

which allows control using mainly nodes.

  1. Create a cube with dimensions of (1, 1, 1).
    enter image description here
  2. 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.
  3. 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.
    enter image description here
    The setup creates a cube grid.
    enter image description here

Create a wave controler object.

  1. 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.
    enter image description here
  2. Add a property to the subprogram for our special controler empty.enter image description here
  3. Next, get the distance of the empty and each cube in the subprogram with the following nodes.
    enter image description here
    enter image description here
  4. 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.
    enter image description here
  5. Now you can shape the cubes by moving the empty and creating the wave shape with the FCurve on it's waveGraph property. enter image description here

Various easily controled shapes are possible.

enter image description here

$\endgroup$
  • $\begingroup$ I would keep the grid mesh and get the distance from the empty to each cube, then add the f-curve into z-loc like this $\endgroup$ – sambler Mar 6 '17 at 6:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.