Jump to content
  • Advertisement
Sign in to follow this  
yckx

Blender->assimp coordinate troubles

This topic is 2640 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I made a test model in Blender, exported it to an X file, and loaded it in my game. It works, but it's orientation is wrong. After playing with the exporter's Left/Right-Handed and Rotate X 90 Degrees settings, and assimp's ai_ConvertToLeftHanded flag, no combination resulted in correct orientation. So then I tried loading the BLEND file directly, Which also loaded with the wrong orientation, and after studying all these incorrect results I came to the realization that at some point in the process, the X and Z coordinates are getting swapped. That's the only explanation I can find for the results I'm seeing.

So, has anyone else encountered this, and is there an easy asset-chain fix, or am I going to have to swap X and Z coordinates in my load routine?

Share this post


Link to post
Share on other sites
Advertisement

So, has anyone else encountered this, and is there an easy asset-chain fix, or am I going to have to swap X and Z coordinates in my load routine?


Could swapping X and Z also be a sign that your program is using a left-handed coordinate system while Blender uses a right-handed one? If so, it seems to me the swap is entirely normal.

Share this post


Link to post
Share on other sites
When I use the ConvertToLeftHanded flag on the loader, the X/Z swap still occurs, and the mesh gets mirrored along the YZ plane.

I've confirmed that rotating the model about the X-axis in Blender rotates it about the Z-axis in game, and vice versa, regardless of whether i use the ai_ConvertToLeftHanded flag.

Share this post


Link to post
Share on other sites
Alright, after stepping away for a bit, I've managed to solve the issue. Even though the Blender coordinate system is right-handed, and I'm using a left-handed system in my game, the mesh loads correctly when the exporter is set to use a right-handed system, and I don't set assimp's ConvertToLeftHanded flag. Go figure. I wonder if assimp silently converts X files behind the scenes, and it was reconverting when I set the flag?

No matter. Problem solved. Yay.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!