- Home /
Applying texture on a texture…? Click for more info
So, what i want to learn is how to apply a texture on a object, over a already applied texture. Kinda like a spray. A wall doesn't change "texture" if you would spray paint on it in real life, it would be a 2nd layer over the "texture". So, what i want to do is, example a gunshot. If i shoot at a wall, there should be a bullet-hole, right? So, how do i add the actual bullet-hole to the wall? And how can i make the gun-shot "sprays/textures" look different depending on what "surface/material" it gets "shot" at? Example, if i shoot at a wall, there will be a gun-shot, made out of the material that the wall is. But if i shoot at a window i don't want the gun-hole to look like a bullet-hole i a wall, i want it to look like a bullet-hole in glass. So, how do i do this? (Please, tell me if you don't understand, English is not my primary language and I'm having a hard time explaining. But just tell me and i'll try again.)
Answer by DwaynePritchett · Apr 21, 2015 at 05:31 AM
I would almost create prefabs of the various "bullet hole" types you want. Then, make a script called Surfaces or something similar. Set a variable in there called "Surface Type". Attach this script to your various objects. When the object gets shot, check to see if it has a component of type "Surfaces" if it does, take the Surface Type from it, and spawn the appropriate prefab for it. Have the prefab designed to fade out overtime and delete itself. This is totally theoretical, and off the top of my head. But, I hope it helps.
-Dwayne Pritchett
i was thinking along the same lines but ins$$anonymous$$d of putting a script on every surface, i would run a script on the player fireing that gets the surface that is hit and does a
getcomponent<$$anonymous$$eshRenderer>().material
and then use that to define what prefab bullet hole you would place.
I think that is a pretty solid option. Remember to add a default case, for when you don't have a unique material/bullet hole relationship for a specific surface.
-Dwayne Pritchett
(If that solved your problem... please check as answered.)