Unity 3D - How to stop objects from clipping into walls

Поделиться
HTML-код
  • Опубликовано: 25 окт 2024

Комментарии • 23

  • @IntensityDev
    @IntensityDev  Месяц назад

    Please Like and Subscribe to support the channel!

  • @blinkachu5275
    @blinkachu5275 7 месяцев назад +15

    No, this is not a solution, and people should stop recommending this
    The moment you do this, your weapon no longer is lit by the environment and will always have the default lighting applied
    Ergo, you LOSE everything that makes the weapon feel part of the world, just so it doesn't clip through a wall
    The proper way to do this is through creating a custom shader for the materials on the weapon to always be rendered on top (difficult), or to move the weapon out of the way (upwards for instance) when you're close to a wall via a raycast check (easy to do)

  • @IluXa4000
    @IluXa4000 7 месяцев назад +8

    That's not a good solution, you would probably want to do smth else with this. Why is this bad? Cause u don't see clipping, but it happens. Imagine that now u may want to shoot enemy at close range, but weapon will fall into enemy collider and your shots won't be registered, cause bullet collision doesn't work from inside of enemy collider.

    • @IntensityDev
      @IntensityDev  7 месяцев назад

      Maybe this solution works for you: ruclips.net/video/jXvVeckLIXo/видео.htmlsi=cztJOA1B74NxHVmS

  • @codeninjasoftegacayandfort9682
    @codeninjasoftegacayandfort9682 5 месяцев назад +1

    thx so much what a great tutorial :)

  • @Strange-y3t
    @Strange-y3t 7 месяцев назад +1

    Thx for this!!!

  • @BundlGaming
    @BundlGaming 8 месяцев назад +2

    I can't do this anymore because there's no clear flags option in unity.

    • @diamon_darms
      @diamon_darms 8 месяцев назад +1

      Camera -> Environment -> BackgroundType -> Unintialized
      Thats it i think

    • @BundlGaming
      @BundlGaming 8 месяцев назад

      @@diamon_darms Thanks

    • @diamon_darms
      @diamon_darms 8 месяцев назад +1

      a thing not shown in the video but that I had to do. In your second camera go to Camera -> Render Type -> Overlay, and your main camera: Camera -> Stack -> + -> your second camera. It worked this way for me

  • @Glasraf
    @Glasraf 9 месяцев назад +4

    Ty❤

  • @ssrs9661
    @ssrs9661 Месяц назад +1

    does you players entire body moves when you move the mouse on x rotation?

    • @IntensityDev
      @IntensityDev  Месяц назад +1

      No, the camera rotates and the weapons are attached to the camera.

    • @ssrs9661
      @ssrs9661 Месяц назад

      @@IntensityDev is it possible to give me that script? i tried to add a 2nd camera for my weapon for scope. but now it just says no camera rendering when i press scope button

    • @IntensityDev
      @IntensityDev  Месяц назад

      @@ssrs9661 ofcourse here is the video off how i setup my playercontroller with the script: ruclips.net/video/JWANj3UoWpU/видео.htmlsi=AmNlgOgJdvXc8GaX

    • @IntensityDev
      @IntensityDev  Месяц назад

      @@ssrs9661 for the scope issue, try to change the POV of the main camera with a script. Don't forget to reset when unscoping.

  • @irfansenatl2701
    @irfansenatl2701 8 месяцев назад +1

    Helpful

  • @MemSczyzna
    @MemSczyzna 8 месяцев назад +2

    is bad practic dude :/

    • @IntensityDev
      @IntensityDev  8 месяцев назад

      What is the good way? :)

    • @lx2222x
      @lx2222x 8 месяцев назад +2

      ​@@IntensityDevHaving a second camera covering your entire screen causes a lot of overdraw which decreases fps by a lot

    • @IntensityDev
      @IntensityDev  8 месяцев назад +1

      @@lx2222x Hmm, i'll try to find a better way. Thanks for the feedback!

    • @MemSczyzna
      @MemSczyzna 8 месяцев назад +1

      renderer objects@@IntensityDev