- Home /
Gun still clips through the wall despite layer masks being applied
Hi, I've been working on a first person shooter for a while, and have been having an issue where my gun clips through the wall. After searching through the internet, I found a solution which uses layers in order to render the gun over everything else, but now I can't even see the gun at all. It's been extremely frustrating and I would like some help from you guys. Here are some photos of the settings: http://imgur.com/a/UThCb
You have a strange viewport size. Are you suee you setup those the way you want? You should only see 1/5 of the screen at the bottom left corner. I guess it has something to do with your "Pixelator" script which probably renders the camera to a texture which is then viewed fullscreen. In that case the cameras don't really draw on top of each other.
I guess you use this one? We don't have the source code of that script so we can't say if it's the cause, but i guess it is ^^.
You would need to wait for all cameras to finish rendering before the script grabs the image.
https://youtu.be/NCtgbNP3AOA?t=1540
This video may help you it has the link is at the correct time for going straight into stopping the gun clipping walls
also dont be put off by the video length of an hour because the gun clipping is about 5 $$anonymous$$s form 25 $$anonymous$$s in
Edit
looking at your imgr picture your gun is a 2D sprite?
cant you just use the sprite Renderer component to order what is render last and there for on top
http://docs.unity3d.com/$$anonymous$$anual/class-SpriteRenderer.html
look at sorting layer and order in layer
@Bunny83 Yes, that is exactly the reason why it wasn't rendering. Thanks.
Answer by KROEYF · Jul 23, 2015 at 05:54 PM
It seems as though my CameraPixelator class was not rendering my second layer.
Your answer
Follow this Question
Related Questions
FPS gun clippes through walls 5 Answers
How to add gun to the model, as when it animate, the gun is dis-positioned. 2 Answers
Problem with camera 1 Answer
FPS Scripting Problems 2 Answers