need help formatting a for loop in vex.
1078
2
0
-
- NicTanghe
- Member
- 193 posts
- Joined: 12月 2016
- Offline
Hello dear houdini magicians.
i'm trying ti cap some geometry using vex and i'm having some problems propperly formatting my code.
i'm using the following code.
for(int i = 0 ; i < 8; i++){
int prim + itoa(2+i) = addprim((3830 + i), "poly");
int (vextex + itoa(8+4i)) = addvertex((3830+i), (prim + itoa(2+i)), 3780-i);
int (vextex + itoa(8+4i+1)) = addvertex((3830+i), (prim + itoa(2+i)), 3781-i);
int (vextex + itoa(8+4i+2)) = addvertex((3830+i), (prim + itoa(2+i)), 3760-i);
int (vextex + itoa(8+4i+3)) = addvertex((3830+i), (prim + itoa(2+i)) , 3761-i);
}
it's the attribute wrangle at the end of the file.
Edited by NicTanghe - 2019年12月9日 14:04:25
Attachments:
Robot.hipnc (292.2 KB)
-
- tamte
- Member
- 8594 posts
- Joined: 7月 2007
- Online
couple of things there but mainly you can't define variable name by string concatenation
nor you need to in your case
also geohandle for addprim() and addvertex() can always be 0, the number you are trying to feed there is gonna be ignored
try this for your first cap:
for(int i = 0 ; i < 10; i++){
int prim = addprim(0, "poly");
addvertex(0, prim, 3780-i);
addvertex(0, prim, 3781-i);
addvertex(0, prim , 3760+i);
addvertex(0, prim , 3761+i);
}
or in simpler syntax
for(int i = 0 ; i < 10; i++){
int pts[] = array(3780-i, 3781-i, 3760+i, 3761+i);
addprim(0, "poly", pts);
}
Tomas Slancik
FX Supervisor
Method Studios, NY
-
- NicTanghe
- Member
- 193 posts
- Joined: 12月 2016
- Offline
Thank's allot for your reply.
It was realy helpfull !
Edited by NicTanghe - 2019年12月9日 20:03:05