# Moving lines along grid

## Recommended Posts

Hi guys,

I'm trying to learn a bit more about geometry creation and manipulation in vex.
I've been attempting to create a simple grid with lines moving along in one direction. Once the line reach the end of the grid, it moves back to the other end. Like a treadmill.
I've been able to create some stuff with addvertex and addprim in a for loop, but nothing nice and procedural.

Anyone have an elegant solution to this?

Thanks

##### Share on other sites

here you gonna find interesting examples

##### Share on other sites

Thanks srletak! Lots of nice inspiration there!

Closest thing I could find was this(though I'm only after a simple 2d solution):

The idea was to then convert each prim to a cube with some spacing. Not a very specific question I'm asking unfortunately...
I'll post an update if I make any progress.

Thanks

Edited by wakimsan
gif too darn big

##### Share on other sites

So, I managed to create a hacky version of my grid. Copied some cubes to it and added some rotation.

Here the grid is static and my rotation is working fine.

However my animated grid is not nice. The everchanging ptnums is an issue:

It yields this result:

So...new technique; creating points from scratch in vex, some simple animation and make sure pointcount stays consistent. Though that leaves me with a different issue and leads me to my question(finally). Is there any way to use the pcfind function to operate on a specific axis/vector? Here I'm currently using it with the distance function to calculate the scale of the points before copying cubes to them:

```int nearpt = pcfind(0,"P",@P,chf("rad"),chi("maxpt"))[1];
i@nearpt = nearpt;
f@dist = distance(@P,point(0,"P",nearpt));
v@scale = @dist/2*chf("scale_mult");```

It only really calculates a single closest point, though I need a separate calculation for X and Z and jam that into the scale vector. I'm trying to keep a consistent gap between all sides of the cubes.

Thanks.

• 1

##### Share on other sites

I managed to find a solution to my issue. The grid animation works quite well for the intended purpose, though a bit heavy. The rotation is a bit hacky. I can't be bothered to do it better atm.
It may not be elegant, but it might be a good starting point for someone in the future.

Edited by wakimsan
gif

## Create an account

Register a new account