Hi there,
I’m newbie scripting and I want to draw lines (or thin cylinders) to connect the nodes represented in this code.
Let me explain a bit how it works:
Given an certain atlas, this function calls some nodes from a specific label and plots them in an “empty universe”. I’m trying to connect them by colored lines assigned to each label.
I mean, for example, if I create nodes from the labels 1, 2, 3 and 4, I want to connect the nodes having the same starting point or ending point.
Here is the code:
//nodes
foreach (Transform location in subregion)
{
foreach (atlasRegionSubregionLocation node in connectomeModel.NodesGlobalIndexer.Values)
{
if(location.name == node.globalIndex.ToString())
{
GameObject sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
sphere.transform.position = location.position;
MeshRenderer currentSubRegionRenderer = sphere.GetComponent ("MeshRenderer") as MeshRenderer;
Material material = new Material(Shader.Find("Transparent/Diffuse"));
Color color;
if (node.regionRef.label == "lateralorbitofrontal")
color = new Color (1,0,0);
else
color = new Color(0.5f, 0.5f, 0.5f);
material.color = color;
currentSubRegionRenderer.material = material;
continue;
// how to add another if statement to create a Primitive as a
// cylinder (or a simple line) and render it if its in the same
// label or Index than the node??
}
}
}
// Berenger : I don't know what are those, you must have forgot
// the beginning of your code.
/* }
}
RENDER = true;
}*/
thanks in advance for any help