Total Noobie -> Placing loaded models. [solved]

Alright guys, I'm really tired of this already and just can't find solution for this on my own… Whenever I load a model from obj file it is placed in some random place, sometimes sooo far from the camera that I have no way to find it… How can I place them where I want? Not at some random place but next to camera for example… being able to put objects on chosen x,y,z coords would be great :frowning:



-Cheer-

The model loaders don't move your models. They will appear with their origin at 0,0,0 in jME. If that is the model geometry's center in the file, the loaded model's center will be at 0,0,0 after loading. But if the model origin is far away from the model in the file, the model will end up that far from 0,0,0 in jME.

Solution:

Make sure your model is placed properly before exporting to .obj or any other format. If that is not possible, you should be able to set a bounding volume on your model, and place your model according to it's center:


model.setModelBound(new BoundingSphere());
model.updateModelBound();
Vector3f geometryCenter = model.getWorldBound().getCenter();
model.getLocalTranslation.subtractLocal(geometryCenter);


HTH

Yeh I'm sure I've set model's center in the middle of the world yet jme put it somewhere~ far away from camera.

But your other idea worked fine, thanks :slight_smile:

-hugs-