getCollision() and names

I load my model


model = assetManager.loadModel(fileName);

System.out.println(">> "+model.getName());


and model.getName() returns filename, which I need.

But when using

String objName = results.getCollision(i).getGeometry().getName();

this is geometry’s name (which I dont need atm, it’s almost always Cube anyway (scenes created with blender)).

Where I find that collision object’s filename?

Probably its a parent of that geometry, so go up the scene graph until you find it.

Ah, I didnt go up enough, had checked .getParent().getName(); but it was


(first time some object throws null pointer so I forgot searching it this way)

You should probably do a recursive search that either terminates when a node has no parent or when the node has the name you searched for. You should not hard-code the search the way you did.

1 Like