Hello,
I'm wondering if there is a sort (or something) function that will compare a given value to all values in a matrix.
What I am trying to do:
I have a matrix of lines that make up the volume of a cube in 3d space. The lines are generated randomly, so I have a class StringLine that has X and Z values, and Y determines what portion of the string will be "lit up." So now I want to add a ball to this environment, in a sort of pong match, so it has float values to determine its location, but the strings are placed randomly, so I just want to find the closest one and light it up.
So if the cube is 1 x 1 x 1, and the ball is at .2 on X and .5 on Z (half way into the cube, .2 from the left) but the closest string is actually at .22 .48 or something, I want that string to get the center of the ball, and so forth. What is the best way of going about this? Does my explanation make sense?
Thanks.
I'm wondering if there is a sort (or something) function that will compare a given value to all values in a matrix.
What I am trying to do:
I have a matrix of lines that make up the volume of a cube in 3d space. The lines are generated randomly, so I have a class StringLine that has X and Z values, and Y determines what portion of the string will be "lit up." So now I want to add a ball to this environment, in a sort of pong match, so it has float values to determine its location, but the strings are placed randomly, so I just want to find the closest one and light it up.
So if the cube is 1 x 1 x 1, and the ball is at .2 on X and .5 on Z (half way into the cube, .2 from the left) but the closest string is actually at .22 .48 or something, I want that string to get the center of the ball, and so forth. What is the best way of going about this? Does my explanation make sense?
Thanks.
1