Hi!
I'm using vex to figure out the width of a rectangle shape and I get an error but I don't get how to fix it. I was trying to initialize the “axis” variable so it would be 0. Right after that, I use an “if” statement that could change the value of “axis” to 1:
// find bbox dimensions
vector max = getbbox_max(0);
vector min = getbbox_min(0);
vector dif = max-min;
// find longest axis length
float biggest = max(dif.x, dif.y, dif.z);
// find what axis is width (X or Z). If 0 -> Z. If 1 -> X.
float axis = 0;
if(dif.z == biggest){
float axis = 1; //error: Declaration of variable ‘axis’ shadows a previous declaration at line 11.
}
How should I change the code?
Thanks.
-Olivier