0
\$\begingroup\$

I have modeled two pinball flippers in Houdini. I exported them as OBJ files and imported them into Unity 2021.3. They look correct in the asset view:

enter image description here

They also look correct when I open them with the default Windows 3D model viewer.

However, as soon as I drag them into the scene, they flip 180 degrees about the Y axis:

enter image description here

My camera is oriented correctly and I have verified that I am using the correct axes in the modeling program. So what is causing this to happen and is there a way I can fix it? I know I can child them to an empty GameObject and rotate them that way but I'd like to fix the root cause, if possible.

EDIT: Here is the orientation of the right flipper in Houdini. I am saving the geometry as flipper_right.obj: enter image description here

In Unity I am simply dragging it from the asset browser into the scene: enter image description here

\$\endgroup\$
4
  • \$\begingroup\$ Have you ensured that It's not attached to something in the hierarchy that rotates it? \$\endgroup\$
    – Tordin
    Sep 1, 2022 at 7:05
  • \$\begingroup\$ Yes; it's at the top level. \$\endgroup\$
    – Matt
    Sep 1, 2022 at 7:37
  • \$\begingroup\$ Can you show us how these objects are oriented with respect to the axes in Houdini? To observe the flip you're talking about, we need to see both before and after states, and you'll need to label whether it's the right or left flipper we're looking at. \$\endgroup\$
    – DMGregory
    Sep 1, 2022 at 11:01
  • \$\begingroup\$ @DMGregory Updated with a couple new images. \$\endgroup\$
    – Matt
    Sep 1, 2022 at 15:27

1 Answer 1

2
\$\begingroup\$

The first thing to understand is that Unity uses a left-handed coordinate system with the convention:

  • x+ = "right"
  • y+ = "up"
  • z+ = "forward"

(You can see this in the naming of the static property basis vectors in the Vector3 type)

That means that Unity will expect most assets to be modelled/arranged in their prefab parent to "face" in the z+ direction.

When you're browsing assets, you usually want to be looking at the front of the asset - to see the face of a character for example, not the back of their head. That means that the Unity asset preview looks at the assets from the z+ side, meaning that it's looking back along the z axis. You can verify this by making a quick little prefab with colour-coded nubs pointing along each positive axis, then looking at how it's oriented in the preview:

Test prefab in asset browser and prefab editing view

So, that solves your first problem: the object is not changing its transformation between the asset preview and the scene view. You just happen to have your scene view camera placed behind the object in the z axis, while the asset preview assumes you want to look at objects from in front.

Now, what's going on with the difference between Houdini and Unity?

Houdini uses a different coordinate system. It's right-handed, which means that to convert to Unity's left-handed scheme, one position axis needs to be negated. Houdini's export to Unity chooses to negate the x axis. So something that points in the x- direction in Houdini will point in the x+ direction in Unity. This conversion step is necessary so that if you're modelling a chiral object like a hand, a left hand in Houdini should import as a left hand in Unity, rather than an inside-out right hand (which is what you'd get without the negation).

You have not shown us the transform inspector for your flipper object, but if you find it's imported with an unwanted rotation, you can tick the "Bake Axis Conversion" box in the mesh import settings inspector to apply transformation changes to the vertex data itself, rather than the rotation property.

\$\endgroup\$
1
  • \$\begingroup\$ Ah, I'd never thought to consider that the preview would look at the asset from the side opposite the default axis orientation but I suppose it makes sense from a 3D games perspective. Thank you! \$\endgroup\$
    – Matt
    Sep 1, 2022 at 19:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .