# VL - Make Particles move along an Isometric Grids Lines

Hey Guys,

im trying to make a bunch of particle move aligned to a grid. So the movement looks like its locked to the grids lines:

this is a bit like the wanderer2d patch, but it would require the particles to behave like this:

On create:
align to point on grid

on Update
set Main direction
set direction tendency
check travelled distance - if ( distance > 1 Gridsegment ) change direction by gridangle

My first try looked like this.

Im not really sure if using frac to check the distance is a smart way, but also have no idea how to sample position values in vl to check the travel distance for particles.

also thought about creating a Grid-pointspread, check for closest point and move the particles by linear interpolation, but again no idea if this would be easier.

Any hit to a somewhat similar patch would be great. I know this should be easy in VL compared to vvvv but im always lost where to start.

Yes, Lerp and an LFO is a good choice. Get two points, Lerp between them and then set destination as start and a neighbor point as new target. The LFO cycle number indicates when to swap the pointsâ€¦

Well, i suggest you to start, by studying how to get this behavior.
From my observation you have 6 ways you can move from each cell, so when your point reaches an intersection, you change direction to the next oneâ€¦

As tonfilm suggested would even do better, you will select next point on tick.
To get randomness you can do some sort of fitting algorithm or grab your direction angle add random to it, make normalized vector, make from possible directions vectors and get closest possible direction or even do that on angles â€¦

Ok thanks :) Is there a help patch on how to â€śsample lerp - sampleâ€ť - ive looked into sample node of bezierspline and the skia svg path sample patches but they seem pretty complex. Not sure how this update loop should look in vl. ( the goal would be to have some spread of particles being added )

so ofcourse my vl patch once again looks like vvvv :) not sure how i would compare distance / select slice of my gridspread and pass on that index in vl

SampleSpreadandLerp_Test.vl (25.2 KB)

( *edited found a hexgrid spread so updated my vl patch with it :) )

kinda what i want but this seems very wrong vvvv like patching :)

SampleSpreadandLerp_Test_Framedelay.vl (33.0 KB)

Since vvvv gamma 2019.2 you can use a data type as property in itself. so you could create a big data structure with all hex points and each point stores itâ€™s neighbours, this saves the information once and you donâ€™t have to re-calculate it in every step.

Iâ€™ll try to patch an exampleâ€¦

Here is an object oriented approach:
SampleSpreadandLerp_Test2.vl (72.7 KB)

1 Like

SampleSpreadandLerp_Test 2.vl (40.5 KB)

shame wasnâ€™t here first

1 Like

Wow thanks guys, so much feedback on forum and chat :) Will work my way through and give an update

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.