Assets not found problem

Except that for whatever reason the spatial is a Node and not a Geometry. Maybe your model got more complicated and can no longer be represented as a single simple mesh.

I don’t have any node in my whole project (except the rootNode of course), this is the code I am using:

[java] spatial_from_blender = assetManager.loadModel(“Models/F_Drive.obj”);

Geometry geo = (Geometry) spatial_from_blender;

geom = new Geometry(, geo.getMesh());

geom.setLocalTranslation(x y, z);


model = geom;[/java]

is there anything special I need to do in Blender when exporting (first time using Blender) because my model is nothing but two metaballs attached together.

update: I get now


however still not reading the obj file

spatial_from_blender = assetManager.loadModel(“Models/F_Drive.obj”);

…is returning a Node. Geometry can only contain ONE mesh and ONE material. So it’s extremely unlikely that an arbitrary model would import as a Geometry.

but why could it be reading it as a Node? as I said the model is simple (two metaballs with 2 different materials) but that shouldnt be a problem right? I already meshed them up together.

why when I write

[java]spatial_from_blender = assetManager.loadModel("Models/Teapot.obj");

Geometry geo = (Geometry)spatial_from_blender; // this works just fine[/java]


[java]spatial_from_blender = assetManager.loadModel("Models/myspatial_ver2.obj");

Geometry geo = (Geometry)spatial_from_blender; // this throws an error[/java]

“(two metaballs with 2 different materials)”

This cannot be represented as a single Geometry. A Geometry is ONE mesh and ONE material. If you have more than one material then you have more than one mesh. So you will have a Node with more than one Geometry child.

Node node = (Node)spatial_from_blender;

Why is that a problem?

because I am using:

[java]Geometry geo = (Geometry)spatial_from_blender;

geom = new Geometry(, geo.getMesh());[/java] thats the only reason I am using a Geom instead of Node

But why would you do that? Just to change the name?

I give every spatial a geom that has its shape (getMesh() and a unique id) in a for loop (reading that from alarge trace file)

thats why I use geom, is there any way I could do that in Node?

So you use one spatial multiple times or each spatial is only used once? I’m trying to understand why you need the mesh at all and can’t just call spatial.setName().

…or at the very least, spatial.clone() and then setName(). What do you need the mesh for?

1 Like

as @pspeed has said your getting a node. A node contains geometries, they are both Spatials but cannot be cast to each other.


[java]Node node = (Node)spatial_from_blender;

Geometry geom1 = (Geometry)node.getChild(0);

Geometry geom2 = (Geometry)node.getChild(1);[/java]

or w/e your node structure is, which can be found by viewing your spatial in the sceneComposer and looking in the bottom left panel of jmp

1 Like

Gotcha! fixed!

PS: just wondering what would the performance be if I create 1000 spatials in the same way.


However my fix was quick and dirty by just using one of the two geomtries (just noticed that) I’m gonna try using the Node to pass the id thru setName

This should be simple but i’m stuck here for some reason and I found a hack to make it work but I really want to understand it:


mySpatial = assetManager.loadModel("/Models/mySpatial.obj");

Node geom = (Node) mySpatial;

Geometry geom1 = (Geometry)geom.getChild(0);

Geometry geom2 = (Geometry)geom.getChild(1);

rootNode.attachChild(geom); // This displays the the model correctly and loads the right materials

geom1 = new Geometry(, geom1.getMesh());

geom1.setLocalTranslation(x, y, z);


model = geom1; // do stuff with it


however the spatial does not move but only one of its geometries (one part of it) moves as expected bc I only passed geom1 to model - OKAY

now if I do this:


mySpatial = assetManager.loadModel("/Models/mySpatial.obj");

Node geom = (Node) mySpatial;

rootNode.attachChild(geom); // displays it but without material


drive_geometries.setLocalTranslation(x ,y ,z);


model = geom; // use this to rotate, translate , etc[/java]

This will give me the spatial without material although it moves correctly and do the rest of the stuff correctly

You create a new Geometry that you modify but never attach anywhere…

if u are referring to model which is an array of spatials I go attach it to the rootNode

So what is it you don’t understand? You seem to be able to discern between node, geometry and spatial now. You understand why you only see a part of the model in example 1. Also I still don’t understand why you create a new Geometry instead of looping through all geometries in the model, assigning the material and name and then use that same node?

I thought I got it till I tried the 2nd example and I got it working without the materials loaded. To my understanding, Node contain my two geometries so if I attach it to the rootNode it should show me the spatial with the material. Why am I getting the spatial w/o the material?

Also what works and I don’t understand is when I load the spatial using:

[java]final Spatial spatialToMove = rootNode.getChild(moveEventsList.get(j).id); // this passes the if of the spatial that is involved in the event

start_location = spatialToMove.getLocalTranslation(); // current drive location[/java]

I was hoping to use something like spatial.getName() but it works regardless… How is spatialToMove finding out which spatial from the previous code has the moveEventsList.get(j).id?

a) I can’t tell because you can tell us for long what you want do in the code we don’t see, there might still be things done wrong

b) Its due to the getChild() method recursing through the children.

thanks normen -would this be considered a bad design to get the children like that?

and how about example 2 why is it not working…

thanks a lot

Because you attach only the spatial you load to the rootNode, hence you see it as it was loaded.

Im sorry if this is taking so long but I still don’t get it although the approach sounds simple;

1- I load a .obj into a spatial → DONE

2- I cast it to a node → DOne // now this node should have the two meshes of my spatial that I loaded

3- give it a unique id and local translation → DONe

4- assign it to an array of spatials that is being read thru a loop

4- once read this node is added to the rootNode

I get it w/o materials although logically I should get it w/ materials… I didn’t do anything other than that.