x


Find connections dont working

OK, I am trying to get connections(up, down, left, right) of the mesh and some knows at the final of the row (at the right) it cant say that the right one is a connection because it would be at the first one of the next row and backwards. So this works fine but when I set the final at the beginning of a row the variable p the values are not completely filled, this means some have a value 0. If someone want to try it an look what I am talking

function Start(){
p[finish] = 1;
nodevalue[finish] = true;
}
function Update(){
var mesh1 : Mesh = GetComponent(MeshFilter).mesh;
var nodes : Vector3[] = mesh1.vertices;
for(actualnum = 0;actualnum<nodes.length; actualnum++){
if(p[actualnum]==setvalue){
if(actualnum-subsize < p.length && actualnum-subsize>= 0){
if(nodevalue[actualnum-subsize]==false){
p[actualnum-subsize] = setvalue+1;
nodevalue[actualnum-subsize] = true;
}
}
if(actualnum+subsize < p.length && actualnum+subsize >= 0){
if(nodevalue[actualnum+subsize]==false){
p[actualnum+subsize] = setvalue+1;
nodevalue[actualnum+subsize] = true;
}
}
if(actualnum-1 < p.length && actualnum-1>= 0){
if(nodevalue[actualnum-1]==false){
if (actualnum % subsize != 0) {
p[actualnum-1] = setvalue+1;
nodevalue[actualnum-1] = true;
}
}
}
if(actualnum+1 < p.length && actualnum+1>= 0){
if(nodevalue[actualnum+1]==false){
if (actualnum % subsize-1 != 0) {
p[actualnum+1] = setvalue+1;
nodevalue[actualnum+1] = true;
}
}
}
}
}
if(actualnum >= nodes.length){
actualnum = 0;
setvalue++;
}
}
more ▼

asked Mar 03 '11 at 11:53 PM

Uriel_96 gravatar image

Uriel_96
930 61 70 81

(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3456
x268
x88
x44

asked: Mar 03 '11 at 11:53 PM

Seen: 314 times

Last Updated: Mar 17 '11 at 02:15 AM