Search Unity

Shoot while gun is inside a wall

Discussion in 'Physics' started by OstrichDog, Sep 27, 2019.

  1. OstrichDog

    OstrichDog

    Joined:
    Jul 2, 2019
    Posts:
    6
    So i have a weapon that works like a grenade launcher, and it was clipping into walls. I quickly solved it by using a second camera to render it, but still if i shoot while the gun is inside a wall, the grenade will explode istantly. Is there a way to shoot it as if the gun is not compenetrating?
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I learned a new word! I'm not clear, do you want to be able to shoot while inside a wall? Are you able to determine if the location is currently inside a wall?
     
  3. OstrichDog

    OstrichDog

    Joined:
    Jul 2, 2019
    Posts:
    6
    Solved it. My problem was that when the gun was inside a wall, the projectile would explode instalntly, but i wanted it to go through it if the gun was directed outside the wall. I probably didn't explain it well the first time and probably didn't even the second time. Anyway i created a small collider at some distance from the gun, so when i shoot if the collider isn't inside the wall, the projectile won't collide with the wall