views:

57

answers:

0

I'm getting this strange error with "InputMismatchException". It likes to come up randomly in the sequence, and it happens every time I run this code. The data I'm using is this:

    VERTEX NORMALS

# num:     x:         y:         z:
    0:   0.509884   0.597177   0.619191
    1:  -0.000495   0.906886   0.421376
    2:  -0.514580   0.582035   0.629637
    3:  -0.660474  -0.550158   0.510980
    4:  -0.000930  -0.413656   0.910433
    5:   0.660142  -0.550859   0.510654
    6:  -0.841061  -0.533520  -0.089293
    7:   0.845736  -0.523353  -0.104081
    8:   0.586233   0.794572   0.158070
    9:  -0.000875   0.986446   0.164085
   10:  -0.595242   0.785507   0.169312
   11:  -0.715520  -0.138788  -0.684667
   12:   0.707744  -0.120059  -0.696192
   13:   0.565350   0.745242  -0.353544
   14:  -0.001049   0.877096  -0.480314
   15:  -0.566422   0.744489  -0.353415
   16:  -0.000869  -0.996127   0.087916
   17:  -0.000757  -0.878011  -0.478641

The code I'm using is this:

if (findPattern(sc, "VERTEX NORMALS")) {
temp = new float[vertices][3];
int test = 0;

for (int j = 0; j < temp.length; j++) {
    if (findPattern(sc, j + ":", 0)) {
        for (int k = 0; k < temp[j].length; k++){
            temp[j][k] = sc.nextFloat();
            System.out.println(k + ": " + temp[j][k]);
        }
    }
}

meshInfo[i].setVertNormals(temp);

temp = null;
}