Hello!
@ antiplastik: Thank you!
@ Quark: I posted what you wrote me via messaging here:
Every shape created has a tag (String) and tagNo (int) which can be set to any value e.g. array index. Code: for (int i = 0; i < box.length; i++) {
size = 5 + (int)random(15);
box[i] = new Box(this,size,size,size);
box[i].moveTo(random(-18,18), random(-18,18), random(-18,18));
box[i].fill(randomColor());
box[i].tagNo = i;
box[i].tag = "Box "+i;
}
Then inside draw we have Code: if(mouseClicked){
Shape3D picked = Shape3D.pickShape(this,mouseX, mouseY);
if(picked != null){
// use tagNo as array index
box[picked.tagNo].fill(randomColor());
}
mouseClicked = false;
}
Quote:How can I give the boxes names? Or an 3D-Index?
All shapes have 2 attributes that the user can do with as they will.
Assuming that we have a shape object called myshape then we can use these attributes to identify our shapes in any way we wish.
Code: // String attribute tag
myshape.tag = "This shape is called box";
// Int attribute tagNo
myshape.tagNo = 101;
println(myshape.tag + " " + tagNo);
// Will display
// This shape is called box 101
Hope this helps.
Greetings, Chrisir