Loading scene from blender

Hi, I have a question on loading scene in blender. It’s simple scene with 4 objects. The problem is that when I load it, all the objects have local/world translations set to (0,0,0) although they are in proper position like in blender. I have a trouble then to set the controls on them - how do I know where to put the control? Am I doing the import wrong? I just export my blender scene to gltf and load it from the game. I tried to apply all transforms on blender, or not apply them - result is the same.

Did you try to load it with the “will always be kind of broken” .blend importer?

Or did you use the “new hotness” GLTF importer?

I used the new hottie GLTF importer :smiley: I export with blender as gltf, then use sdk to convert gltf → j3o and load j3o directly as “assetManager.loadModel”

Are you using linked objects by any chance?

I was using linked objects or as called “proxy objects” (library override) that can be moved on the scene, but then I switched the models to “append” option from blender. I will check it to be sure later.

Select a single object in blender and export it as gltf instead of exporting all of the objects as one scene.

Then you position each individually.

When you select the object in blender, it will display that objects x,y,z location so you can use it in jme.

To be clear, linked objects, proxies, etc… should work but there is a bug in the Blender’s GLTF exporter that wipes out their transforms (and some other things). It’s supposedly fixed in newer versions so it may be version dependent.

…but I also haven’t had a chance to confirm that it’s really fixed yet.

Ok, so I can confirm that I use append in blender. I don’t understand the answer with exporting all of the objects from blender manually - it’s a lot of manual work. First exporting each object, then set the coordinates through code checkin it one by one in blender. I would like it to work like so: I set the models positions in blender for example obj1 (1,2,4), obj2 (2,4,5) and then after converting to .j3o all objects are positioned in my game in coordinates obj1 (1,2,4) obj2 (2,4,5).

Since you don’t say what versions of things you are using, the best I can do is point you to the existing gltf issues so that you can track them.

That explains why I had same problem. Just assumed it was something I was doing wrong and worked around it.

There is still an open issue where objects linked multiple layers deep dont work correctly.

1 Like

Thanks, moving from blender 2.90 to 2.91 solved the problem with coordinates, however now if I add character control to my model, the control is distant from the model.

I added control to the first model from the left side. Dalev4 is geometry, which has local translation 0, but it’s parent is armature that has non zero translation. I’m using jme 3.2.2-stable.

That means your mesh itself is off in space somewhere. The control is at the ‘origin’ of your model.

In blender, the models origin is not necessary the world space origin. The issue you are seeing is normally caused by the model having a different origin in the blender scene than the world space. The gltf exporter does not create separate coordinate spaces for object. You can change the object to be translated from the world space origin in blender to get to the correct position, instead of the mesh being translated in the node coordinate space to correct the issue.

Can you tell me more how to do it? Is it some settings of blender during export?

No, it is something that has to be done in the scene, assuming that absolute scene position relative to the origin is actually the issue.

1 Like