Jump to content

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

Link to comment
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):

 tumblr_nhem70bBYT1r2geqjo1_500.gif

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
Link to comment
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.
grid_rotation_static.gif.9f03232c0dcd48cc21bfdace80a73814.gif

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

It yields this result:

grid_rotation_anim.gif.ed22ef065095437464ab4174fc28a7e7.gif

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:

cubes_to_points.gif.d4fa97f4252e7d987a2f76f1499b7b7e.gif

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.

  • Like 1
Link to comment
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. 

working_gridAnim_rotation.gif

rotating_grid_v001.hipnc

Edited by wakimsan
gif
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...