1
\$\begingroup\$

First off, I am very new to jMonkeyEngine 3 and still learning. Not exactly sure what could be causing my snowman to have already been rotated before import. I created him in blender and it was facing forward. The up axis was Z and the forward axis was Y.

For some reason when it is imported into jMonkey I got it pre-rotated which is not what I wanted nor what I coded. I just imported like this tutorial says to do in the book.

Exported as ORGE > Converted to .j3o > Imported with code.

snowMan = assetManager.loadModel("Models/Snowman/snowman.j3o");
Material matVC = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
matVC.setBoolean("VertexColor", true);
snowMan.setMaterial(matVC);
rootNode.attachChild(snowMan);

What should I look at doing to try and remedy this? Not even sure where to start. Could it be messed up in blender? The way I exported? jMonkey?

Update #1: I think it has to do with either the exporter or something I did in blender... not sure what though. Pretty sure it is not the fault of jMonkey.

Now it looks like this.

enter image description here

enter image description here

enter image description here

enter image description here

\$\endgroup\$
0
\$\begingroup\$

That's a left vs right hand coordinate system. It's actually not a rotation but a reflection. It seems that blender uses a right hand coordinate system and jMonkeyEngine or Ogre use left hand coordinate system. If you want to convert between the two system check this detailed paper, with the simplest solution being to flip the actual Z direction.

Also here is a related SO question.

\$\endgroup\$
  • \$\begingroup\$ Ok, so I see the Quaternion math... how would you go about this in jMonkey? Would you just rotate the rootNode, or each object? I tried flipping it myself before asking... still has a small tilt like in the pictures. \$\endgroup\$ – gemurdock Feb 3 '14 at 23:54
  • \$\begingroup\$ @gemurdock I think you only need to flip the final matrix when you export the file. \$\endgroup\$ – concept3d Feb 3 '14 at 23:55
  • \$\begingroup\$ Since Ogre exporter doesn't support this how would you go about this? \$\endgroup\$ – gemurdock Feb 4 '14 at 2:32
  • \$\begingroup\$ I just finished trying this with a new Cube... It did rotate it weird, so I think your right, but it was rotate in more of a 45, 90, 180 degree kind of thing... not this off by 15 to 20 degree... so I think there is still something else at play as well. Maybe something I messed up in blender like the origin. Still not used to blender yet. \$\endgroup\$ – gemurdock Feb 4 '14 at 2:46
  • \$\begingroup\$ While the Axis are switched around, everyone in my reading keeps saying both are right handed coordinate systems. hub.jmonkeyengine.org/forum/topic/… and blender.stackexchange.com/questions/471/… - So not exactly sure what to think now. Waiting for you to have a chance to get back to me. \$\endgroup\$ – gemurdock Feb 4 '14 at 15:34
0
\$\begingroup\$

Issue is the the OGRE exporter and will be contacted soon about issue.

Recommend to use .obj with UV Mapping instead since it does not support vertex coloring.

\$\endgroup\$
0
\$\begingroup\$

I know this is an old thread, but I just had this same problem and got it fixed, so..

Select your snowman in blender and press alt+R to clear rotation. Now it's probably going to look the same as in jMonkey. Apparently the ogre exporter doesn't apply rotations you made to the object.

To fix this, apply the rotation permanently to the snowman in blender: from the object menu -> apply -> rotation. Now it should load fine in jMonkey.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.