Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Texture overriding

Discussion in 'General Graphics' started by XxSimBaaxX, Jun 14, 2017.

  1. XxSimBaaxX

    XxSimBaaxX

    Joined:
    Oct 23, 2016
    Posts:
    18
    I am building a fps game and I have textures for bullet holes. the issue is that when I shoot an edge of the wall the texture of the bullet hole goes out and floats in the air:
    Screenshot (15).png
    I also had to raise the textures about 0.05 above the wall texture to avoid it from flashing and glitching.
    is there any way to play the texture without raising it and make it override the wall texture without floating at the edges??
    pleaesseeee help and thanks in advance
     
  2. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,445
    Yes, there is. One way is to use Projectors. Another more complicated way is to add them manually using a CommandBuffer.
     
    XxSimBaaxX likes this.
  3. XxSimBaaxX

    XxSimBaaxX

    Joined:
    Oct 23, 2016
    Posts:
    18
    thank you man this helped me alot, but for the projectors, if you look at the picture above, the bullet hole is right at the edge of the wall. if I used the projectors and there was another wall behind that wall it will cast a bullet hole on them both right? like half of the hole will be on the first wall and the rest that ended up floating without the projectors will be on the first surface to reach
     
  4. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,445
    Well, half would be on the first wall and it would be fully on the second wall. Not that unrealistic, since the bullet would have damaged the first wall on the corner and continued.

    You can adjust the range of the projector to your needs of course. Combination of one or more raycasts and a projector should get you pretty far. Even to do specific things when you hit a corner like this.
     
    XxSimBaaxX likes this.
  5. XxSimBaaxX

    XxSimBaaxX

    Joined:
    Oct 23, 2016
    Posts:
    18
    thank you so much for the huge help
     
  6. Koehler_Games

    Koehler_Games

    Joined:
    Feb 17, 2019
    Posts:
    5
    How did you do it? I have had no luck.
     
unityunity