- Home /
FPS (sometimes) invisible gun?!
I want to make a fps game. I have a human model with a gun, and I added a camera to its head to make it show what the model actually sees. When shooting, I want the camera to see the gun, but I'm experiencing some weird behavior in Unity. When the model is rotated forward (ingame: north) while shooting, you cant see the gun. But when rotating to all other sides, the camera sees the gun, and you can see it. I think its because the camera is colliding with the model, but why only at some angles?
Answer by skovacs1 · Oct 21, 2010 at 03:49 PM
It is likely not "collision" per say, especially if you didn't add any Collider to the camera and/or neither has a rigidbody. What you are likely experiencing is camera clipping. If your camera near plane is passing through the model the model (or parts of the model) will be culled. As you move the camera, there are obviously some angles at which you near clip plane is not intersecting your model.
The solution is to not have your camera's near clip plane intersect your model. Fixes include changing your near clip plane, moving your model away from the camera more, rendering your model on-top (possibly as a separate pass).
Answer by Guest 1 · Oct 21, 2010 at 04:20 PM
If you have an animation on the weapon mesh, try either removing the animation or change the animation settings to always update/render. Sometimes animations (skinned renderers) clip where you didn't really expect it to.
Also make sure that you are not having backface viewing where the back sides of polygons face the camera and is culled away.
What you mean by the camera is culled away? and what does it?
The camera isn't culled. I meant the polygons (that face the wrong direction) are culled away. I find it kind of hard figuring out what is going on without more details/a webplayer test. Is it a sudden "pop" in visibility?
Your answer
Follow this Question
Related Questions
Zooming in with a gun, Halo style. 2 Answers
I need help with my script 3 Answers
How to make a gun and export it into Unity3d? 2 Answers
How do I connect gun, hand models to anim and camera 0 Answers