Jump to content
wakimsan

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 this post


Link to post
Share on other sites

chos55s1.gif.dc2e1251e8d21eac01d30da81fed986d.gif

here you gonna find interesting examples

 

Share this post


Link to post
Share on other sites
Posted (edited)

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
Posted (edited)

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×