.obj import multiple objects from blender

Hiya,

I was wondering if anyone could help - I have a number of objects in blender (platforms) that I've added to an object group and exported using the settings suggested here:

http://www.jmonkeyengine.com/wiki/doku.php?id=exporting_.obj_models_from_blender



When the object is loaded though, it is always a TriMesh (casting to Node always fails). Any suggestions?

Cheers :slight_smile:

It doesn't matter really if it is a TriMesh or Node.

If you need it as a Node, you can just attach the TriMesh to the Node.

Thanks for the quick response!

The problem I'm actually having is that I'm detecting collisions where there aren't any - if I have two platforms separated by space then collisions will register between my player (a box :slight_smile: ) and the space, as well as the platforms.

I'm a bit confused, as it works ok with 3ds, although I'd rather use .obj since people seem to recommend it!

Thanks again!

It seems like the obj included with jME build works correctly (exported as Node). So far all my obj files from blender seem to load as a single TriMesh even though they are separated into groups/objects/materials.

Did you check if the bounding volumes have the correct size ?

Maybe you scaled the model down and the Boundingvolum is somehow still at the original size or something.



How do you do collision detection?

Heya,

Thanks again for getting back to me!

I'm using calculateCollisions, and printing a message if there's a bounding collision (boundCollisions.getNumber()>0).

In actual fact though, it seems to be ok now. Not sure what I've changed, but it's working fine!

Sorry to be a pain :slight_smile:

Cheers!

This is the most straightforward solution I have found so far:



To keep a scene graph hierarchy, I use nodes within Blender. You can add empty nodes in Blender (Add -> Empty), which behave as nodes, and which can contain other nodes and meshes. You can use "make parent" to make a given node (or many) a child of another one.



This also gives you the nice advantage of being able to use the "outline" view in Blender, which will show your scene / model graph in a tree view.



Grouping is not going to be exported, so I use it in Blender just to ease edition.



Finally, I export through Collada (1.4) to jME. I tried OBJ but it wasn't exporting all the hierarchy information.



If you do it like this, each node will get a bounding box which will contain all the child nodes. I think this is what you are looking for.



Also this allows you to keep each node in its own local coordinate system, which works like a charm if you need to rotate some objects around their own center, or to scale them, or to translate them or perform calculations with them. You will probably prefer to keep objects centered around their own coordinate system.



Hope it helps.