PDA

View Full Version : Sorting a two-dimensional array



m90
March 8th, 2009, 06:44 PM
Hello!

As some of you might already have noticed today (:P) I am storing Vector3Ds in a two-dimensional array. So I have an array like "myArray" which will consist of 6 seperate Arrays, each containing 5 Vector3D Objects. Basically it's the 6 sides of a cube with each 4 points as vectors plus Number 5 is the center of the face.

Now I'd like to sort the myArray[0 to 5] based on x, y, and z-values of the myArray[x][4]-Vector3D.

I thought I'd have to use sortOn('[4].x'), but this doesn't seem to have any effect on the sorting. How would I refer to these values correctly?