- Home /
Is a 'Tube' mesh possibly in Unity3D?
HEYAYAYAY…. Anyway, I'm in the process of creating some assets for a game I'm working on. Now this isn't my first time with Unity3D (albeit my first serious try), but I'm asking:
Cheetah3D has this neat 'Tube' object. I haven't exported to Unity yet, but it appears to have normals on both sides (well, duh). My question is: can I have this as a sort of 'room' that can be explored on the inside, yet viewed from outside?
I read previously somewhere (I think on the KSP forums) that Unity doesn't support concave meshes due to the limitations of PhysX, but I still need to know for sure, before I spend a bunch of time on something that was never going to work.
Thanks.
@equimrar are you there champ?
i happened to stumbled on this tremendously shorter answer than $$anonymous$$e to the same question!
hope it helps
So since my mesh already has normals on both sides, I can simply apply the shader? The thing is that it's not a closed mesh, so I don't see how back face culling would take effect.
"So since my mesh already has normals on both sides"
That is not possible. $$anonymous$$esh is single sided.
What you are seeing in Cheetah is two meshes back to back.
{OR it's using an internal Cheetah "trick" to paint the back of a mesh. (I am sorry I don't know which.) }
When Cheetah exports that it will export it as two meshes back to back.
All mesh is single sided. (Yes, you can use a "trick" of a special shader that will paint the back of mesh, BUT that is really irrelevant here. It sounds like you need a normal, everyday mesh for using with colliders and so on.)
Just as Bunn mentions "this tube object already has two seperate sides" - it's not a case of "one" mesh with normals on both sides. Hope this helps.
Answer by Bunny83 · Sep 26, 2012 at 03:57 PM
You mixed up a lot of different things ;)
Yes, you can have tube objects in Unity. From which side it can viewed depends only on the shader. Most shaders use backface culling, so they only render the "front" side. Each vertex only have one normal (at least in Unity). So you have only one normal for light calculations. It's possible to "transform" the normal in the shader, but usually you just model both sides as seperate triangles, one facing the front and one the back side.
Concave mesh-colliders are possible, but the only exception is that Unity (or PhysX) can't handle collisions between two concave (or non-convex to be more precise) colliders. Primitive colliders (Box, sphere, capsule) and convex meshcolliders can collide with non-convex coliders without any problems.
Ah I see, confusion ensues! So basically, if I have this capsule collider representing a character, he can move about and collide on the inside of the tube without any problems?
Also: the 'tube' in question is not a cylinder with the top faces deleted, it is actually a tube: http://flic.kr/p/derZwZ
Well, this tube object already has two seperate sides (as it should be ;) ), so each surface has it's own normal. So far for the rendering.
Yes, collisions usually should work just fine as long as no incredible large forces / velocities are used.
Yay, thanks a bunch! Just to clarify, all I need to do is add a mesh collider to the whole thing, right?
Yes ;) If the Renderer / $$anonymous$$eshFilter is on the same object, the $$anonymous$$eshCollider will automaticalls pick this $$anonymous$$esh as collision mesh. You can also use a different mesh if you want. Just assign the $$anonymous$$esh to the mesh variable of the $$anonymous$$eshCollider ;)
Say @Bunn .. do you happen to know:
say you have a "back-to-back mesh". So it's one plane bent over, ie, a flat "U".
Simply do you know, does that work as a $$anonymous$$eshCollider?
Or does it confuse the mesh->to->meshcollider system in Unity, or, confuse PhysX ?? Cheers
(File under "too lazy to test" :-) )
Answer by whydoidoit · Sep 26, 2012 at 03:53 PM
Yes you can. Normally such a shape has faces pointing in both directions (doubling up) but you can render the back face of a single face if you use the right shader too. MeshColliders are the thing with the convex property - they are a bit fragile - it depends what you want them for, but they back face cull which can lead to problems. Normally you would map primitive colliders onto your scene to make it more robust.
I would suggest that you make a scene out of bits that you construct in a modelling package rather than trying to render the whole thing there. Unity has a limit of 65,000 vertices per mesh in any case.
Your answer
Follow this Question
Related Questions
How do I make a series of primitive planes and roll them into a tube? 1 Answer
moving hole 3 Answers
Null Reference Exception Assigning Vertices to Mesh 0 Answers
Md5mesh uvs and vertices bugging 0 Answers
Weapon system 0 Answers