- Home /
Why do quads face the back viewport?
Alright, I have Googled my fingers to the bone, searched every Answer, scoured the forums, read the documentation, and perused every external tutorial / article on this subject, and I am not satisfied with my search results. I have finally, after several months, had a nervous breakdown, and I am willing to... Ask... for help.
Why do quads face the back viewport???
When I click GameObject>Create Other>Quad, it will create a Quad that faces away from the Front Viewport.
If I'm in any other 3d program in existance, when the viewport indicator says Front, you are looking at the FRONT of the composition. When you create an object and go the front viewport, the front of that object should face you. This is how it should be.
Yet when I create a Quad, it faces AWAY from me. I have to go into my back viewport in order to see the front of that quad.
Here at work, we have pulled our hair out and adopted a "Quad Must Face Front/ Viewport Front and Back and Obviously Swapped in Unity" philosophy. This just seems unhealthy.
We are exporting items from Max with the x axis rolled forward from -90 to 0. This SEEMS to work, because when I drop the mesh into Unity, and look at it in the Front Viewport, lo and behold, Front faces Front, Back faces Back. Sounds wonderful.
Alas, the programmers like being able to dump the meshes into quads via code. Create a Quad, replace the quad with a mesh yanked from an FBX, and bob's your uncle. Here's the funny part- even though the Quad faces AWAY from the front viewport, the swapped mesh will still face front.
Here's a picture to illustrate my point. It is taken from the Back Viewport, but rotated at a little angle to show depth, and the orientation of the viewport gizmo... It shows several boxes, more or less properly aligned. It shows 2 quads, facing towards the back. The quad on top, notable in it's green collision box, contains a copy of the box mesh, with it's front still facing front and it back still facing back.
I fully expect to be told to try Google, but as I've said earlier, I have been at this for quite a while. There is NO documentation on WHY QUADS FACE THE BACK VIEWPORT. If there is, I will apologize for the caps, thank you profusely- probably too much- and I will even post an article about all this on the youtube. I think there's a lot of people who could use a solid- SOLID- explanation about all this.
I love you guys! Keep rocking!!!
The CreatePlane editor script in the Unity Wiki builds planes. By default it build them like Unity...vertical like Quad or horizontal like the Plane, but it would take just a couple of lines of code to reverse the normals (wrap the triangles the opposite direction) so that the visible face was on front rather than the back side.
$$anonymous$$ake a material that uses a 2-sided shader (no culling), and apply that to your quads. OR try using empty GameObjects and gizmos.
I haven't seen any explanation why. Unity didn't even have simple quads by default for the longest time. It was only added recently in version 4.2. They've said before, the primitives are meant for rapid prototyping, and not really for serious development.
Thank you all for the responses! I am not sure I understand them all, but I'm glad you gave them! I'll try to wrap my head around this, but yeah, it seems that:
Even if you rotate the x from -90 to 0, left and right will be switched somehow...
In Unity, X becomes positive when you drag it to the left, negative when you drag it to the right. In $$anonymous$$ax, this is the complete opposite.
In Unity, Y becomes positive when you pull it up, negative when you push it down. In $$anonymous$$ax, Y is horizontal. It will become positive the further it is pushed away from you. When you rotate the object's alignment, it becomes like Unity, even though your transform gizmo will still say it's z.
In Unity, Z becomes negative when pushed away from you, positive when pulled towards you. In $$anonymous$$ax, Z is positive up, negative down.
In order to adjust to Unity, the mesh needs to be modified in $$anonymous$$ax, and I start with rotating the X axis from -90 to 0. This puts the Y axis in perfect alignment, but the Z and the X are still not aligned mathematically- that is to say, the Z becomes positive when you pull it to you ins$$anonymous$$d of push it away, and the X axis becomes positive when you drag it to the left ins$$anonymous$$d of right.
So aside from modifying Unity, is there a way to flip that value? Am I missing something really obvious?
Again, I am really grateful and impressed by the response. You guys really are the best.
Answer by JCX · Apr 21, 2014 at 08:25 PM
quad was supposed to be ready for 2d added in unity 4.3 until that there was only plane
robertbu is right if you need different quad, you can just make editor script or wizard to do that, create 3 vertices, connect them to mesh and set each vertex it's normal and uv and you have it
Answer by Ed unity · Apr 21, 2014 at 08:47 PM
theProtolith I am not quite sure that you are correct in what you are saying. Unity uses a Left-Handed coordinate system and thus positive X is to the right and Positive z is forward. On the viewport gizmo, the Colored directions for each axis are the positive directions for that axis.
When you create a new Unity project, the Main camera's original position is facing down the positive Z axis. Thus when you create a quad, that quad is visible because the Normals of the quad are facing the negative z axis. In your case this would technically be facing the front viewport, but would have the same normals as the back viewport.
If you view the textured cube that you have, it is not rotated correctly. The top and bottom are correct, but the front/back, left/right are facing the opposite directions. You can tell by matching the texture to the correct axis directions. Then you will be able to see that the Quad is in fact lined up with the front viewport as you expect it to be.
Thank you for the response, Ed.
Unfortunately, it did not answer my question. The box in the picture is really irrelevant.
The real answer I need is Why Are Unity's Quad Primitives Rotated Away From The Front Viewport.
If you create a Quad- Unity's Quad Primitive, not your own- it does not face the front viewport. It faces the rear.
I need to know WHY.
$$anonymous$$y employer is convinced that he can use Unity's Quad primitives as if they were gold- he calls them up in code, and then replaces the mesh called Quad with whatever mesh I give him. When this happens, the model will still face the front viewport like I think it should, but he wants it to face whatever direction the Quad Primitive is facing. This means more than just rotating my object 90° along the x axis.
I need conclusive proof that using Quad Primitives like this is wrong. And if I'm wrong, I need to know! This has become a really sore point here at work.
If anybody can help, I would be eternally grateful!!!
Unity's Quad Primitive is NOT rotated away from the front viewport. That is what I explained in my answer. You can rotate the quad after it is created, but that does not cause all other newly created primitives to receive the same rotation.
From what I can tell, he is actually doing more work than if he were to create an empty game object and then assign it the mesh you provide and finally rotate the transform to face the direction that he wants. Doing this would prevent the object from having unnecessary collision components.
The other option would be to create a prefab object with the components needed (Transform and your $$anonymous$$esh), and then Instantiate the prefab and rotate it.
If you can show the quad is not facing the front viewport when created, please provide the project in a bug report.