Making a polygon from predefined points in vex.

   4444   6   0
User Avatar
Member
193 posts
Joined: Dec. 2016
Offline
Total noob qestion here i was having some dificulity finding an answer to my question.
i was trying to make a road in a tunnel.
i started by wanting to make a polygon by feeding the points 0,1,21,23 into addprim.

as such
int road1 = addprim(0;“poly”; points) For some reason the array i put here does not not apear 1,0,23,21.


Nothing happened. now i'm stuck.
also anny help with making some sort of for loop to automaticly add poligons to all the bottom surfaces whould be greatly apreciated.
Edited by NicTanghe - Oct. 11, 2018 18:05:20

Attachments:
Tunnel.png (49.7 KB)
Tunnel2.hipnc (78.5 KB)

User Avatar
Member
2039 posts
Joined: Sept. 2015
Offline
Please submit your hip. There's not enough info, like how your wrangle node is set up, and how you created the array.

This function works fine for me and can do what your intending.
User Avatar
Member
193 posts
Joined: Dec. 2016
Offline
I added my hip to the main post.
User Avatar
Member
83 posts
Joined: Aug. 2018
Offline
As for your vex problem you had some typos in the code
This should work:

addprim(0, “poly”, array(1,0,23,21));

But your approach does create “illegal” polygons if you connect the road that way and is highly dependent on the point order and on that subdivide.
Mariusz Wesierski @ Mackevision
User Avatar
Member
2039 posts
Joined: Sept. 2015
Offline
Your wrangle is also set to primitives…so your going to get 32 of the same created primitive. Set it to detail mode for just one.

Also, you could use curlybraces, not saying it's better, just another option for you to know about:
int road1 = addprim(0,“poly”, {1,0,23,21});
User Avatar
Member
193 posts
Joined: Dec. 2016
Offline
ok so i'm switching to a new tactic for creating the tunnel so the points are lined up.
However i am having issues with creating a for each loop in vex. i can not figure it out for the life ofme.
I tried in vex and with a normal for each loop. i cant figure out how to do for each point in ID (or group.)

i whould greatly apreasiate anny help that can be offered.

Attachments:
Tunnel2.hipnc (151.6 KB)

User Avatar
Member
2039 posts
Joined: Sept. 2015
Offline
Does this work for you?

Attachments:
Tunnel3.hipnc (157.2 KB)

  • Quick Links