Going going gone!

I seem to be having a problem with my meshes!
I have a few meshes that seem to disappear a various viewpoints.

Attached is a picture that shows one particular mesh. The two images on the LHS show the webplayer, the RHS image shows the mesh in Unity.

I rotate around the object using the mouse orbit script - at certain points the mesh just disappears, usually at the same viewing orientation.

My viewing planes are set at 0.01 and 1000 - so I’m fairly sure that’s not the problem.

It’s using the standard Diffuse shader - so it can’t be that.

It happens in the web player on my PC and on my iBook - so I’m guessing it’s not a driver issue. (It doesn’t happen in the unity game view though)

This leads me to suspect it’s the mesh itself but what could be causing this?

46793--1708--$combo_211.jpg

If the camera were to move past the center of the object, wouldn’t the object be culled? (Actually, once it was closer than 0.1, the viewport min distance.) So two things I would look for are, if the scale of your object is very small, you could be within 0.1 of it without knowing it. Secondly, check the coordinates of the mesh. One would expect the center to be at the centroid of the mesh, but I believe it is possible to create an off-center mesh and import it in such a way that the origin is elsewhere. I don’t actually know how Unity would cull the mesh in such cases though. So treat this suggestion with a grain of salt. Nonetheless, it could explain why at certain rotations the object disappears.

As a quick test you could try to pull the camera back a ways, see if that changes the behavior.

Aha! good suggestions.

I checked scale, which is is 1,1,1 so it’s not that.

However your origin suggestion has merit - see picture.

But how do I set the origin to the center of the bounding box in Unity?

46832--1711--$mesh_204.jpg

This would probably help, but it may be easier to fix it in a 3D modeler.

http://unity3d.com/Documentation/Manual/HOWTO-FixZAxisIsUp.html

Theres a three pronged axis button at the top of the scene view, click that so the handle centres itself on your mesh, press f to focus there, then create an empty game object and it should be at the middle of your mesh…

Use this as target for mouse orbit.
HTH
AC

Targos: I already have a seperate center of view game object that I am orbiting around.

My hunch is that as the center of the mesh is currently outside itself, when this point passes beyond the camera near clipping plane the whole mesh is culled.

I’ve tested this by using models with a correct origin, but it would be nice to prove the case by ‘fixing’ the original mesh in unity.

This should not happen. Unity culls objects away when their bounding box does not intersect view frustum anymore.

Send in a bug report with the project folder where this is visible; we’ll take a look.