www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: Thomas. on March 06, 2011, 04:23:23 PM

Title: array of SimpleVectors
Post by: Thomas. on March 06, 2011, 04:23:23 PM
Why is here error? Length of array is 3, but I can not read or write ...

SimpleVector[] positions = new SimpleVector[positionst.countTokens() / 3];
int positionsnumb = 0;
float x = Float.parseFloat(positionst.nextToken());
float y = Float.parseFloat(positionst.nextToken());
float z = Float.parseFloat(positionst.nextToken());
positions[positionsnumb].set(x, y, z);
Title: Re: array of SimpleVectors
Post by: EgonOlsen on March 06, 2011, 11:12:51 PM
Nobody fills that array with actual instances of SimpleVector...
Title: Re: array of SimpleVectors
Post by: paulscode on March 07, 2011, 04:14:58 AM
Yeh, try changing that last line to:
positions[positionsnumb] = new SimpleVector(x, y, z);
Title: Re: array of SimpleVectors
Post by: Thomas. on March 07, 2011, 09:55:58 AM
Thanks :)