Hi folks,
Imagine, in geo nodes, i have a grid (100x100), either mesh or curve.
I want to place an instance (say a small UV sphere), and have it move randomly along the grid, turning left or right, sometimes going straight, basically random.
Anyone have any idea how you might achieve that?
And if that’s possible, i guess it would also be possible to add a weight to it’s movement so it tended to head to a specific point, although taking some ransom twists and turns along the way.
Me-thinks this is a job for some logic nodes?..but any ideas?
Something like this?
random_movement_geonodes.blend (107.4 KB)
You can use the capture attribute node to assign a random vector from the set { (-1,0,0), (1,0,0),(0,-1,0),(0,1,0)} to every vertex of a mesh line.
Then you can use the accumulate field node to sum up all of these vectors up to a given vertex in the line, and assign the sum as the new position: this will give you a random path on a grid. By using different weights for the four movement directions ( I used 50% on the movement to the right, 20% on up, 20% on down, and 10% left), you can make the path eventually reach the right boundary.
Converting the mesh line to a curve and using the sample curve node allows you to move an object along this path.
You could probably add some limitations after the accumulate node to keep the path on a given grid.
1 Like