I have a 3rd person camera that has it's .forward always pointing towards a specific object.
Occasionally this object finds itself behind other objects/meshes (like walls for instance).
I have a script that checks if this main object is visible by casting a ray from the cam's forward/center to this object's position.
I would like to be able to make a "hole" in the any mesh hit by the ray that is not the main target object described above; I would like this hole to originate from the rayHit.point's position.
I'm thinking the hole can only be an illusion, perhaps a superimposed alpha mask texture that will hide a circular subsection of the wall's alpha.... (like a square image, all transparent, with a black circle in its center).
How can I do this in script? Apply an "layer mask" to a material...?
Or perhaps another way of accomplishing what I am describing...?
Thanks!
↧