Could somebody please guide me how to obtain the trimeshes from a given node/spatial?
Thanks!
Just grab your node, call getChildren.
Check if the returned array containes instances of Geometry, then to a getBatches on it.
Hmm, I dont understand how you go from a GeomBatch to getting the TriMeshes.
I dont know if getBatches was supposed to be a reference to a function, because it doesnt exist in Geometry.
There's a method in Node called getChildren which you can use to iterate through TriMeshes:
for (Spatial s: node.getChildren()){
if (s instanceof TriMesh){
TriMesh mesh = (TriMesh) s;
// do something with mesh
}
}
Ok, thanks for the reply - but im no closer to achieving what I want. If I explain:
I load a 3D model from file into a Node. I need to obtain the Tangents for a particular TriMesh within this Node. I don't know how many TriMeshes make up the model - could be one, could be one hundred, but I need to identify these TriMeshes. Im guessing some sort of loops outputting the Spatials names, that would help.
Try this:
public void outputNames(Spatial s){
Also take into account that is a Spatial is not a Node, it is a Geometry… and Geometries should be TriMeshes… if not, you could just getGeomBatch on the geometry, and set up a TriMesh with this info and you would be pristine.