- Home /
Skinned Mesh disappears when too close
I have this character (from Mixamo), and esp on Mac and Web builds, he disappears when too close to the camera (PC much better). And by too close, I mean like 2 meters. And by Skinned Mesh I mean that all other rendered objects are just fine even very close. I attached a sphere to the character, which I can see just fine at any distance, even when the character mesh is invisible. I already set the near clipping on the camera to be pretty small. I don't see any special clipping settings for skinned meshes. Any ideas?
In Unity 3.4, you can see the actual bounds of the mesh as a white AABB. Does this box look correct for your model? I've certainly seen things like this, and it is always because the bounding box is not what it should be, usually because a child has been moved beyond the precalculated BB of the skinned mesh (which is precalculated, I believe from the animations), such as by having the ragdoll bodies not moving a bone with the Skinned$$anonymous$$eshRenderer attached.
I was just gonna say, I can see it if I look at its feet (where the transform root of it is). So that sounds likely.
Answer by DaveA · Aug 18, 2011 at 12:30 AM
From Warwick Allison's hint, I looked into this bounding stuff, and found if I turn on 'Update When Offscreen', run, it fixes it. I can even turn that off again and it's better. My character's eyeballs (which I did not add, came with the model) then disappeared, but I was able to pull the same trick by turning on 'Update When Offscreen' for both of them too.
Just note that, depending on how the object is used, that's an expensive option to enabled (doesn't matter of course if this is the player character, but updating off-screen NPCs would be unnecessary cost). So I'd be tempted to keep looking for a different solution, or use the new feature of Unity 3.4 to adjust the bounding box by hand (I've not tried it).
Right. What I'm saying is, I turned it on, ran it, then turned it off again. So it fixed the on-disk version apparently. I was able to turn off 'Update When Offscreen' and it works just how I want. It would be nice to have a 'fix bounding boxes' one-time button though.
Thanks Dave!
I had a very similar problem, and this fixed it.
It's a very strange fix tho... probably never would have figured that out.
Answer by MaVCArt · Aug 12, 2013 at 07:40 AM
I have this very same problem - Unfortunately, due to performance reasons, I am not able to use the "Update when Offscreen" option, since we're using this for our game's NPC's, which tend to get pretty heavy.
The option we're looking into right now is to manually set the bounding box at runtime, but on that front, we haven't yet figured out how - the bounding box would need to encompass the maximum extents of the mesh, including all possible animations that would be used for it. Is there a way to somehow sample each animation frame in an FBX file, and in that way get the maximum extents values for that file?
I'm continuing my search beyond this thread, so if and when I find a solution, I will make sure to update my post here :)
UPDATE:
I have managed to fix this issue; the following thread provides the answer:
http://forum.unity3d.com/threads/44704-Fix-for-animation-bug
As you can see, this problem is most likely caused by Unity incorrectly setting the root of the file, by creating a root of its own. At least, for me, the issue was solved by inserting an empty, unlinked dummy in my fbx file, which forced Unity to set the Pivot of the FBX file to that dummy, for some reason.
I hope this helps someone :)
this solved my problem. Reassigning the root bone setting on my skinned mesh renderer to the highest transform in the heirarchy of my character.
Answer by migue0583 · Sep 27, 2021 at 11:40 AM
The problem may be the Bounds of the Skinned Mesh Renderer. The bounds are supposed to be a cubic area surrounding the mesh. Try using the Edit Bounds button on the Inspector, with the disappearing object selected.
Answer by x1alphaz1 · Nov 06, 2021 at 01:34 PM
For Anyone who's facing this issue. U need to set the rootbone position of the attached object to the position of the Main SkinnedMeshrenderer rootbone position
Example:
O1 = Main.GetComponent<SkinnedMeshRenderer>();
O2 = Attached.GetComponent<SkinnedMeshRenderer>();
O2.rootBone.transform.position = O1.rootBone.transform.position;
Your answer
Follow this Question
Related Questions
Skinned Mesh Renderer Combining submesh issue 1 Answer
Animated mesh is clipping in viewport and in game camera 1 Answer
Putting Together Multiple Rigged Models 1 Answer
How to make an object reappear? 3 Answers
Applying different boneWeights to SkinnedMeshRenderer creates unwanted vert stretching 2 Answers