- Home /
Draw on area of contact
I have an object that goes through walls. however, just making it clip through it looks weird, so I want to add a black circle around the area where the object and the wall collide
How would I go about doing that?
Answer by lgarczyn · Jan 25, 2020 at 12:31 AM
An easy way would be to add two projectors with a limited range on both ends of your object, pointed towards the center of the object. You can use a cookie as your effect texture.
This won't work well in some settings though.
Another way is to use a shader using a depth test cleverly, and a stencil. Basically you have a flat-shaded capsule collider around your hand, that only displays if it is behind a wall.
The problem is that it will always render behind every wall, so you use another shader to limit this, by using a stencil to only allow rendering if the other shader has rendered on top of it.
You can do a lot of cool things like that:
https://forum.unity.com/threads/boolean-shader.161527/
You can do most of this using shader graph, without any code:
Your answer
![](https://koobas.hobune.stream/wayback/20220612222022im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How can the player position updates randomly when the player isn't movingl? 0 Answers
OnCollisionExit problem 1 Answer
3d Collision for 2d objects 1 Answer
3D enemies keep sliding on the terrain 1 Answer
Jump on the ground 2 Answers