Jump to content

Babylon shows a different result


fdeng
 Share

Recommended Posts

Hi Everyone,

I'm a newbie  to Babylon.js, I got a question need someone to help.

When I load a  3D model (eg. obj format model) with Babylon.js, it shows a different result than I expected.

The correct result should be (The door is on the left side)

image.png.4b5c7d6a99028db71af4170f62e8e54d.png

 

But with Babylon.js, the model is like below : (the door is on the right side, it seems that all the meshs are rendered opposite direction)

image.png.352ff244b80593b0571e2f1fc2de711b.png

 

Can anybody tell me why?

Is there a parameter that can be set to correct this issue?

 

Link to comment
Share on other sites

  • 2 weeks later...

@sable

Hi,

There is another issue with this right-hand model if the active camera is a FreeCamera.

When the mouse moves in left - right direction, the model moves up - down, while move the mouse up - down, the model moves left - right.

Can anybody tell me how to fix it?

Link to comment
Share on other sites

@sable

@brianzinn

Thanks for you guys' help.

I just found that I set the  rotation of FreeCamera mistake, sorry, please ignore the mouse move issue.

 

As the exporting tool I use has no such exporting option, I can't get a left handed model.

Still, there is something trouble me, it seems that babylon has Y as the up-axis, the building is not standing correctly.

Normally I should see the front, not the bottom of the building.  (You can use ArcRotateCamera to have a look what the building is)

could you please help me on this point.

The PG is below:

https://playground.babylonjs.com/#4QU0BY

Link to comment
Share on other sites

Hi @fdeng

It looks like many CAD/3D software (mainly for buildings) have the height on the Z axis, while Babylon or other WebGL libraries have Y.

I encountered the same issue and I used a pivot matrix on my mesh to flip the two axis : https://playground.babylonjs.com/#4QU0BY#2

On lines 25-26 you can see the 1's are switched, an untouched matrix would look like this :

1, 0, 0, 0
0, 1, 0, 0
0, 0, 1, 0
0, 0, 0, 1

(You can also put values different than 1, and it will scale on the corresponding axis)

There might be others/better solutions but in my case it seems to work great, and allows to keep original positions.
 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...