Field of View Effect in Unity (Line of Sight, View Cone)

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ก.ย. 2024

ความคิดเห็น • 596

  • @CodeMonkeyUnity
    @CodeMonkeyUnity  5 ปีที่แล้ว +21

    See this effect in action in Survivor Squad and Survivor Squad: Gauntlets
    Get the Game Bundle at unitycodemonkey.com/gameBundle.php
    See what I'm teaching here applied to real games!

    • @EliteHumanNetwork
      @EliteHumanNetwork 5 ปีที่แล้ว +1

      Are you proficient with HTML 5 game developed?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  5 ปีที่แล้ว +1

      @@EliteHumanNetwork Nope never tried out HTML 5. I jumped from Flash straight into Unity.

    • @RM-lw2qi
      @RM-lw2qi 5 ปีที่แล้ว +1

      In the game you are showing at 1:18 the light is much smoother than the one we create in this video. Could you elaborate on how you created that smoother effect without hard edges? Really great tutorials btw!

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  5 ปีที่แล้ว +1

      ​@@RM-lw2qi The effect in the game is actually done using a different method. Each Survivor has a camera pointing to where they can see, then the depth from that camera is used combined with the main camera to then generate the effect with a shader.
      The reason why that effect works in there is because that game is 2D but all the Walls and Doors are 3D objects, that method doesn't work in a pure 2D game.
      However with this method you could create a 2D shader to achieve a similar result.

    • @PatrickNusbaum
      @PatrickNusbaum 4 ปีที่แล้ว +7

      @@CodeMonkeyUnity Would you mind giving a hint on how to create such a shader?

  • @StixxyTape
    @StixxyTape ปีที่แล้ว +27

    For anyone who was really stuck like me:
    if the Field of View isn't showing up after setting its layer to mask, then check the material. Make sure it's surface type is set to transparent and not opaque. Worked for me after a bunch of trial and error, so I hope it works for you too! :D

  • @francoiskrugerpersonal2985
    @francoiskrugerpersonal2985 2 ปีที่แล้ว +59

    From 18:27 you can't really follow the video anymore :( But here are updated steps:
    1) Open Windows > Package Manager & install Universal RP
    2) Create a "Rendering > URP Asset (with 2D Renderer)"
    3) "New Universal Render Pipeline Asset" is your "LightweightRenderPipelineAsset" and "New Universal Render Pipeline Asset_Renderer" is your "CustomForwardRendererData". I added these names in () to easily follow the video.
    4) Go "Edit > Project Settings" and on the "Graphics" tab drag in your LightweightRenderPipelineAsset
    5) On the CustomForwardRendererData go "Add Renderer Feature > Render Objects" 3 times and set your settings like Mask, BehindMask and Black in the video
    That said, I'm still battling to get the stuff working like in the video. Code Monkey or anyone else would you be able to reply with the missing steps I can't get right? It feels to me that the settings in each of the Render Features need to be a little different to your video? Also, I don't know where the "CustomForwardRendererData > Default Layer Mask" setting is anymore?

    • @billycombo8298
      @billycombo8298 2 ปีที่แล้ว +3

      If you download the package for this project, you can imporant the URP files and they work perfectly, you'll just need to change the layers around if you don't have your layers set up the same way he has

    • @fyodorzaletov3237
      @fyodorzaletov3237 ปีที่แล้ว +3

      Hi. I don't think you need any more help, but it might help others. In general, you need to make not a Renderer Pipeline 2D, but a Universal Renderer, which will have Filtering settings. after playing with them and adjusting the layers, you will finally be able to achieve the desired result!

    • @husdf_
      @husdf_ 7 หลายเดือนก่อน

      This help a lot, thank you very much@@fyodorzaletov3237

    • @KOLHO
      @KOLHO 3 หลายเดือนก่อน +1

      If anyone has any problems after minute 18:27, just download and install the Universal RP package and continue configuring it, as shown in the video.
      => Open Windows > Package Manager & install Universal RP
      Note: make sure that the layers are configured correctly, as shown in the video.

  • @dash-t5489
    @dash-t5489 7 หลายเดือนก่อน +2

    If anyone has problems with the outdated last part of the video, another alternative you can use is:
    ·Create a function to check if a point is inside of the mesh using mesh.bounds.Containts(Vector3 point)
    ·If it's inside you enable the visual, if not, don't
    Personally I used a singleton pattern in the player's fov to have the function on any object I needed to toggle the visual.
    Once again thanks CodeMonkey for such a great content!

    • @JJFiapoko
      @JJFiapoko 4 หลายเดือนก่อน

      Hey @dash-t5489, I was hoping you could share your code for that. I am pretty new and completely lost on the last part of the video. I would love to see what you ended up doing instead in more detail. If you have the opportunity to share it. Or just screenshot or screen record the process.

  • @StixxyTape
    @StixxyTape ปีที่แล้ว +34

    2nd tip for anyone who was stuck like me:
    If the field of view disappears when the game object goes out of the camera's view, try putting this line of code mesh.RecalculateBounds(); after setting the mesh.vertices/uv/triangles stuff, like this:
    mesh.vertices = vertices;
    mesh.uv = uv;
    mesh.triangles = triangles;
    mesh.RecalculateBounds();

    • @설민우-z1u
      @설민우-z1u ปีที่แล้ว +1

      thank you. I think I've been struggling with this problem for a week. I am infinitely grateful to you.

    • @kazoomonster237
      @kazoomonster237 ปีที่แล้ว +1

      gud fish

    • @jarrettonions3392
      @jarrettonions3392 11 หลายเดือนก่อน +1

      Wow... i dont know how long it would have taken.. thank you

  • @Arti32Lehtonen
    @Arti32Lehtonen หลายเดือนก่อน +2

    Some tips for current URP users
    1) If you use a URP with 2D option during creation a project, you need to change renderer data. Create URP Universal Renderer using context menu. Put it instad of Renderer 2D under "Rendering / Render List" options inside UniversalRP scriptable object.
    2) Inside URP Universal Renderer find Filtering options. Set Opaque Layer Mask to everything. Change Tranparent Layer Mask as shown in the video.
    3) Add render objects as shown in the video.
    4) Set material to the FieldOfView mesh. Surface type of material should have a type Transparent.
    5) If something is wrong, check Project Settings. Your URP asset should be present in two places: Graphics / Scriptable Render Pipeline Settings and Quality / Rendering / Render Pipleine Asset.

    • @rayanedahmani4711
      @rayanedahmani4711 21 วันที่ผ่านมา +1

      Brooooo I LOVE YOUUUUUUUUUUUUUUUUU! Spent a whole day on it

  • @Emicenizo
    @Emicenizo ปีที่แล้ว +16

    FYI: The combination that worked for me on URP is:
    Opaque Layer Mask: Default, TransparentFX, Ignore Raycast, Water, UI
    Transparent Layer Mask: Default, TransparentFX, Ignore Raycast, Water, UI, Objects, Black
    Also, if you are importing CM's files, keep in mind that the Render Steps on the CustomForwardRenderData may not have the correct Layer Mask by associated (check that on each).
    Finally, I added the CustomForwardRenderData asset to both the Graphics and Quality menus on Edit > Project Settings > Graphics and > Project Settings > Quality.

  • @DridgeDEU
    @DridgeDEU 4 หลายเดือนก่อน

    I felt like I HAD TO wrote how amazing this script is and also thought perhaps others could also benefit from how I learned from this video.
    After watching the tutorial and following along, I tried to do the same thing again and to do my own script to create this custom mesh. This turned out to be a gigantic task which took me around six hours, and I didn't even get all the things done like defining the angle, having a different starting position and view orientation etc. But that way I really honed the idea of creating custom meshes in code, especially such a complicated one like areas of a circle like you do here.
    I'm actually a programmer by trade but doing all these mathematical calculations is quite something else; kudos to you that this seems so easy to you and that you even share it with the whole community. I love about your script how versatile it is with the different parameters on top. Truly impressive.

  • @ancalagon1144
    @ancalagon1144 4 ปีที่แล้ว +54

    For anyone else having problems with the angle of the fov in relation to your aim being wrong:
    Try writing + fov / 2f;
    Instead of - fov / 2f;

    • @Virtualangello
      @Virtualangello 3 ปีที่แล้ว

      Thank you good sir/madam. I was looking for this solution

    • @DerAbsender
      @DerAbsender 3 ปีที่แล้ว

      Thank you, I was this close to replacing that part with a few if statements.

    • @설민우-z1u
      @설민우-z1u ปีที่แล้ว

      Thank god...

  • @soco5338
    @soco5338 2 ปีที่แล้ว +1

    Thing about your videos that I really love is that when you type, I have to slow down the video speed to .25f and to hear what you're saying I need to speed it back up to normal. It's a very fun game to play while trying to learn what you're teaching.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  2 ปีที่แล้ว +1

      Always remember that you're not expected to be able to completely follow and implement a tutorial in the time that the video takes.
      When you see a 20 minute tutorial it absolutely did NOT take me 20 minutes to learn all this and build it.
      A simple 20 minute tutorial has hours or days not to mention my 20 years of programming experience behind it, so you're not expected to follow along in real-time.

  • @FluidicClient
    @FluidicClient 4 ปีที่แล้ว +83

    Would be nice if you could make a version of this for unity 19.3 as the URP does not work in the same way.

  • @cheezcola
    @cheezcola 4 ปีที่แล้ว +28

    I wish you had a class on everything from 18:30 onward. I like to be able to implement everything and have a deep dive on it. Any suggestions?

    • @Bipeovideo
      @Bipeovideo 4 ปีที่แล้ว +41

      he's just kind of like:
      "step one: draw a triangle
      step two: color the triangle in
      step three: go over to the custom forward rendering script that you just know how to get and somehow knew ahead of time I was going to tell you to use."

    • @sirpentineplays5560
      @sirpentineplays5560 2 ปีที่แล้ว +1

      @@Bipeovideo do you know how to implement it? i can't find it anywhere

    • @ComprarAlimento
      @ComprarAlimento 2 ปีที่แล้ว +10

      mini tutorial for those who didn't get it:
      1 - install universal RP from package manager.
      2 - Create a "pipeline asset".
      3 - Assign the custom pipeline in player settings (graphics tab).
      3 - Create the layers as seen in the video.
      4 - Change "UniversalRenderPipelineAsset_Renderer" (or whatever you called) adding the "Render Objects" (Mask, behind mask and black) and changing the values according to the video.
      5 - Remove those layers as seen in video but only on "Transparent layer mask" (keep them selected on "opaque layer mask").
      the rest is easy...

    • @daxetor4991
      @daxetor4991 2 ปีที่แล้ว +1

      @@ComprarAlimento the 5th one helped me a lot. thank you so much!

    • @Что-г9е
      @Что-г9е 2 ปีที่แล้ว

      @@ComprarAlimento Hello I from Russia and I ask you to explain the tutorial in a little more detail

  • @matthewventures
    @matthewventures 4 ปีที่แล้ว +14

    Important step missing! After you setup the Lightweight Render Pipeline Setting you must set your Project Settings-> Graphics -> Scriptable Pipeline Settings to use it! th-cam.com/video/YAOin1eqcFc/w-d-xo.html

  • @hakanviajando
    @hakanviajando 3 ปีที่แล้ว +8

    Thank you very much for your videos. Scriptable Render Pipeline part was very interesting but it's really difficult to understand for people who don't know about buffers, stencil etc. I hope you do some in-depth tutorials about SRP. I would be happy if anyone who sees this message recommends other resources to learn about it.

  • @KOLHO
    @KOLHO 3 หลายเดือนก่อน +1

    If anyone has any problems after minute 18:27, just download and install the Universal RP package and continue configuring it, as shown in the video.
    => Open Windows > Package Manager & install Universal RP
    Note: make sure that the layers are configured correctly, as shown in the video.

  • @inf3243
    @inf3243 2 หลายเดือนก่อน +1

    Just a heads up that you're gonna be in for a world of pain if you attach your field of view object to your player character. You want it as its own object, at 0,0,0 in the scene. Otherwise you get all sorts of rotation problems!

  • @darksideskyy
    @darksideskyy 4 ปีที่แล้ว +12

    how did you do literally any of the prep work for the rendering stuff after 18:30? i was following along and then i couldn't do anything else because even your FoV package's rendering stuff wont work because its missing scripts...

    • @Bladeshifter20
      @Bladeshifter20 4 ปีที่แล้ว +1

      Part of the issue He has LWRP installed but I dont think he ever has you get it through package manager. Aside from that, LWRP no longer exists and is not Universal Rendering Pipeline. It the comment above I explained how to get through some of these issues.

    • @elektra81516
      @elektra81516 3 ปีที่แล้ว

      Install Universal Render Pipeline

    • @1166miki
      @1166miki 3 ปีที่แล้ว

      @@elektra81516 Where can i find that? i can't find it neither in the asset store or the package manager. Thank you

    • @1166miki
      @1166miki 3 ปีที่แล้ว

      nvm, the issue was that the project was in the latest beta

  • @loisdeniau1225
    @loisdeniau1225 3 ปีที่แล้ว +3

    I do manage to make it work with URP in 2020:
    -create a new 2d project (without URP)
    -import the package
    -install URP
    -in project settings -> graphic, put the render given in the project
    -put the mask material alpha higher than 0.5
    For some reasons create a project already with urp before import the package does not work (Maybe some LWRP / URP conversion not doing well, have no clue)
    Also, you need to add a new sprite for the floor (because he is missing)(put the white pixel for instance, don't forget to expand it).
    You can lower the treshold of the mask shader to 0 to hide it (I don't really understand why but a value lower than the treshold make the mask material unusable).

  • @deliriousmansano3556
    @deliriousmansano3556 4 ปีที่แล้ว +1

    I will watch your videos on June after we graduated because we do lot of things now til march. I started learning the basic of unity, the UI, animation. And when I graduated I will learn how to make 2d games.

  • @francoiskrugerpersonal2985
    @francoiskrugerpersonal2985 2 ปีที่แล้ว +1

    I battled a lot to get my field of view to interact with the walls. My problem ended up being that my FieldOfView game object had a 0.5 scale to it, which made the rays smaller (barely visible). In case this ever helps anyone :)...THANKS FOR ALL YOUR WORK CODE MONKEY! REALLY APPRECIATE IT!!!

  • @dekabreakable
    @dekabreakable 2 ปีที่แล้ว +13

    For anyone having issues with the FOV origin being offset by a some units, make sure that for the tutorial, you set the FOV gameobject to 0, 0, 0.
    That was not mentioned in the tutorial in any meaningful way.

    • @adventureman6997
      @adventureman6997 8 หลายเดือนก่อน

      use URP not 2d core o wait its been a year 🥶

  • @adventureman6997
    @adventureman6997 8 หลายเดือนก่อน +1

    guys if you are on a newer unity and cant get the lightweight render thing to work you have to go to project settings > graphics and change it

  • @frithjofmeinke7789
    @frithjofmeinke7789 4 ปีที่แล้ว +16

    Great tutorial! The last part about the CustomForwardRenderer really could have saved me hours of research about custom shader programming in the URP without the Shader Graph. Does someone have any tipps on how to make the edges of the Mask softer/blurred out like in the game Survirvor Squad? Thanks in advance and keep up the great work!

    • @sirpentineplays5560
      @sirpentineplays5560 2 ปีที่แล้ว

      sorry to bother you, do you know how to get the customforwardrenderer in your project? i've looked everywhere and can't find it anywhere

    • @frithjofmeinke7789
      @frithjofmeinke7789 2 ปีที่แล้ว

      @@sirpentineplays5560 Sorry i can't help you.. I am currently working with UE and didn't touch Unity in a while.

  • @SwitchZetto
    @SwitchZetto 3 ปีที่แล้ว +15

    How do I make the LWRP part work with URP? Some things are very different like Opaque Layer Mask and Transparent Layer Mask

  • @1166miki
    @1166miki 3 ปีที่แล้ว +10

    Hi!
    Could you add the scripts of the ForwardRenderer? I feel like the first part of the tutorial was way easier than the end. Thanks anyway!

  • @maximielos
    @maximielos 2 ปีที่แล้ว +1

    I struggled a lot to get the enemies to appear within the FOV. They were either not appearing at all, not disappearing, or only visible outside of the FOV, but changing the Queue for the mask to Opaque worked for me. Hopefully, this will help other people that are struggling with this.

    • @lukaivicevic
      @lukaivicevic ปีที่แล้ว

      This worked for me, thank you!

  • @catplays88
    @catplays88 4 ปีที่แล้ว +3

    Reminds me of a game called NOX..nice work dude :)

  • @zachpetersen9250
    @zachpetersen9250 3 ปีที่แล้ว +6

    Wouldn't it be more efficient to declare all the variables once before start instead of every frame?

    • @MrTastelessVideos
      @MrTastelessVideos 3 ปีที่แล้ว

      It'll also be easier to use (x * 0.5f) instead of (x / 2f) like wtf, also converting between angle to radians? Cmon that's easy.. a(radians) = a(degrees) * pi/180 = a(radians) = a(degrees) * 0.01745f because pi / 180° = 0.0174532925, no need for Division here lmao, such a waste

    • @TheSkyGamez
      @TheSkyGamez 3 ปีที่แล้ว

      @@MrTastelessVideos or radians = degrees * Mathf.Deg2Rad

    • @MrTastelessVideos
      @MrTastelessVideos 3 ปีที่แล้ว

      @@TheSkyGamez I honestly ditch such preset API fields/methods almost always, because you almost never know whats going on in the background - especially for relatively simple math Problems - also this is just unnecessary overhead, simply calculate such constants beforehand and just hardcode them in, easy as that

  • @agtechart
    @agtechart 4 ปีที่แล้ว +7

    Hi! First of all, ty for this tutorial! Could you make a tutorial about the Scriptable Render Pipeline??

  • @jseneque
    @jseneque 4 ปีที่แล้ว +3

    Again a very informative tutorial. Thank you

  • @MrBusinessDragon
    @MrBusinessDragon 3 ปีที่แล้ว +4

    Hello! Overall great tutorial! I am having some issues with getting the URP to work with the layer masking though. I have all my layers set up right. It seems to not work? I could be missing something There are 2 layer mask options as well. do i use both or only one?

  • @Tiparium_NMF
    @Tiparium_NMF 3 ปีที่แล้ว +4

    I fee like you went through the section where you make the field of view actually show enemies a little too fast. Other than that, great tutorial.

  • @jean-michel.houbre
    @jean-michel.houbre 3 ปีที่แล้ว

    An excellent video, which TH-cam forgot to notify me.

  • @omgnogod666
    @omgnogod666 2 ปีที่แล้ว +4

    If you are like me.... I forgot to update the angle=startingAngle; so the angle was not updating....
    15:10
    For the "UtilsClass.GetMouseWorldPosition()"
    Create this method (ideally static of some class), then call GetMouseInWorldPosition() instead:
    public Vector3 GetMouseInWorldPosition()
    {
    Vector3 worldPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
    worldPosition.z = 0f;
    return worldPosition;
    }
    He also doesn't really explain the "vObject.GetPosition()" but that turns out to just be "transform.position" (the player's position, since this script is on the player)
    15:40
    So the lines will be:
    Vector3 targetPoisition = GetMouseInWorldPosition();
    Vector3 aimDir = (targetPoisition - transform.position).normalized;
    Otherwise, nice video!

    • @washablerelief_8843
      @washablerelief_8843 ปีที่แล้ว

      Thanks man! This is exactly what I needed.

    • @omgnogod666
      @omgnogod666 ปีที่แล้ว

      @@washablerelief_8843 happy to help out!

  • @cavejumper
    @cavejumper 2 ปีที่แล้ว +2

    If your mesh disappears when moving you need to call mesh.RecalculateBounds(); since the bounds didn't move after creation.

    • @cavejumper
      @cavejumper 2 ปีที่แล้ว

      Also if there could be update to this video with the 2d lightning system. Couldn't get it to work my self and didn't find any answers online.

  • @ZirixNightcore
    @ZirixNightcore 5 ปีที่แล้ว +4

    You do some nice work, good job

  • @zbeb118
    @zbeb118 3 หลายเดือนก่อน

    Hey codemonkey, thanks for the amazing tutorial as usual, quick question, I am making a hide n seek game and the seeker has the effect you just made, but what if I wanted to be the hider? The render settings also apply to me, how would I be able to disable them if I were to pick hider and be able to see everything as normal but still have the seeker only see what is in it's fov? (It's a multiplayer game that's why I am worried about the seeker too)

  • @honeygamesstudio
    @honeygamesstudio 4 ปีที่แล้ว +5

    Please update the project to the Unity version 2020.+

  • @Linknerd
    @Linknerd 5 หลายเดือนก่อน

    I may have been the only one or maybe I was stupid and wasn't listening but please make specify that the raycast is from 0,0. I spent an hour trying to figure out why my raycast wasn't working when it was working perfectly fine at 12min30s

  • @DahamVoid
    @DahamVoid 3 ปีที่แล้ว +4

    great tutorial as always. I cant figure out how to create a half-transparent material, anyone can help?

  • @tylermiller1606
    @tylermiller1606 4 ปีที่แล้ว +5

    Oh damn, survivor squad was this guy lets goooo

  • @garethlynch2823
    @garethlynch2823 2 ปีที่แล้ว +2

    Is there any way you can create this effect without using LRP? or other render pipelines other than built-in? I'm currently using a package that relies heavily on the old Post Processing V2 and fixing everything after changing over is a nightmare. Perhaps I'm overthinking this?

  • @cristiano4826
    @cristiano4826 5 ปีที่แล้ว +2

    Great as always👌

  • @jaynecurnow5694
    @jaynecurnow5694 หลายเดือนก่อน

    Hey! Love your tutorials, and I am aware that this is an older tutorial, but I am having an issue with the field of view and the collisions. When the FOV collides, its almost as though there is an invisible object between the player sprite and the box I am looking at. I have looked in wireframe and there definitely seems to be some kind of space with mesh edges. Thank you again though, I really enjoy and learn loads from your videos :)

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  หลายเดือนก่อน

      Sounds like either it's an offset on the visual, maybe the mesh is offset? Or maybe the origin calculation is wrong?
      Or perhaps it's a scaling issue, maybe the mesh is scaled in some way
      Or it's the colliders on the wall that are bigger than the visuals
      You can download the project files and compare with your own

    • @jaynecurnow5694
      @jaynecurnow5694 15 วันที่ผ่านมา

      @@CodeMonkeyUnity Thank you so much! I played around with it a little more, made sure pivots were in the right place, checked the positions of everything as well as making sure everything was in it's right place (parents, children) and it's fixed! Thank you for getting back to me :D

  • @xiaoyou9412
    @xiaoyou9412 4 ปีที่แล้ว +3

    Mr.Monkey, I'm following your lesson to create a Conical, It's awesome! But I have created a TIlemap before and now the tilemap has coverd my Mesh Grid , so how can I do to make the Mesh Grid up to tilemap layer?

  • @Kurock1000
    @Kurock1000 5 ปีที่แล้ว +5

    Can you do this with a mesh not generated by code? A lot of units using dynamic fov would tax the heck out of a system..

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  5 ปีที่แล้ว +2

      Maybe you could do a GPU implementation using a compute shader.
      But for a lot of cases you can save up a lot of performance by doing several tweaks like reducing number of rays if the unit is too far from the player or only calculating it once every 3 frames.
      Beyond that there's always DOTS, using it you should easily be able to get several thousand working.

    • @DavidB-rx3km
      @DavidB-rx3km 4 ปีที่แล้ว

      50 is a daft amount and just an example, you would need objects to be tiny for it to matter at that level. I think 10 would do, especially if the object is animated, and would add to fuzzy sight detection.

  • @henyersbaltar219
    @henyersbaltar219 4 ปีที่แล้ว +4

    I'm using this tutorial in a combination with what I am already making. Okay so for some reason the origin of my cone is at an offset to the right of my player and anything that collides with the FOV is also projected at an offset to the right. I tried to look all over the code to see if I did anything different from what you did but i noticed no mistakes. Do you have any suggestions on where I should look to see why this offset is occurring?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 ปีที่แล้ว +4

      Check the position of the FieldOfView Game Object, it's probably not at 0,0
      You can download the project files and directly compare with your own

    • @colinmasucci4044
      @colinmasucci4044 3 ปีที่แล้ว +1

      I had this same problem. I believe it had something to do with it being a child. Once I made it its own object it was fixed.

    • @postymusic4387
      @postymusic4387 2 ปีที่แล้ว

      @@colinmasucci4044 I have the same offset problem. it only occours when the FOV is a child of the player. I would like to make all this a prefab, so also enemies can use it, is there any fix to it?

  • @davidson2727what
    @davidson2727what 3 ปีที่แล้ว +3

    I'm trying to convert this into 3d.
    I have some debug rays being drawn and they are all near the player and move with the player when the game starts, but the rendered mesh moves much faster in the X, Y, and Z directions.
    Do you know what could be causing this?

    • @davidson2727what
      @davidson2727what 3 ปีที่แล้ว +2

      Talked with a guy on unity forums. Basically the mesh is using world space while the debug rays are using local space.

    • @tonyj2800
      @tonyj2800 2 ปีที่แล้ว

      This was very helpful!, I too was running into that issue that it has been a pain to figure out. Thank you so MUCH!!

    • @tonyj2800
      @tonyj2800 2 ปีที่แล้ว

      @@davidson2727what Any chance you can share how you fixed the issue? since I am assuming that Physics.DrawRay would also be localspace

  • @dolguldur1833
    @dolguldur1833 2 ปีที่แล้ว +2

    Hi Codemonkey,
    As far as I know, using the forward renderer doesn't allow us to use 2D lighting, only the 2D Renderer does.
    Is there a way to implement this while being still able to use 2D lights?

    • @dknyoiwi
      @dknyoiwi 2 ปีที่แล้ว

      You can use an asset called smart lighting2d as a light source

  • @WakeTheShark446
    @WakeTheShark446 3 ปีที่แล้ว +2

    Could you please update this tutorial so it better covers the stuff around the 18 minute mark and show alternatives to the Render Pipeline as from what I can see in the comments, that's no longer supported.

  • @TheJamnikER
    @TheJamnikER 3 ปีที่แล้ว

    THANKS! Very helpfull tutorial

  • @chelsais
    @chelsais 3 ปีที่แล้ว +2

    !HELP! For some weird reason when I do 11:56 my FOV turns into a small rectangle. How do I fix this?

  • @vima9046
    @vima9046 ปีที่แล้ว

    Hello CodeMonkey! There are a couple of things i don't understand very well is this video. The first concerns the render pipeline(18:35). I don't understand very well what you are doing since i dont know much on RP. So, if i got it, based on how you order the layers in the settings it gives priority to one layer over another, am i right? This confuse me because you said that the RP is not rendering the layers that you remove from the list but actually we can see them on playmode. Do you have any advice in order to become more confident with these RP settings? The second is about the mesh bounds. Why the player don't draw the FOV at certain distances?

  • @anthonyortiz7924
    @anthonyortiz7924 3 ปีที่แล้ว +1

    @CodeMonkey, this is a really great tutorial on 2D LOS and fog of war, you really break it down into steps that make it really easy to understand, thank you! The downloadable project files no longer work in the latest versions of Unity due to their rendering pipeline update; are you planning on updating this (and other) tutorials? Many thanks, liked and subscribed!

  • @poltergeist6917
    @poltergeist6917 5 หลายเดือนก่อน

    Is there a way to make the behind mask layer still visible in the editor? It makes stuff a bit more convenient in the editor

  • @alfonso.k
    @alfonso.k 2 หลายเดือนก่อน

    I have the mesh and the mask all working fine individually but can't get the mask layers interacting each other. I suspect that it is a issue with a shader but haven't been able to figure out.

  • @AmIDuckQuack
    @AmIDuckQuack 3 ปีที่แล้ว +12

    *Anyone who want to attach the FOV to the character:*
    Start method:
    transform.position += new Vector3(-transform.parent.position.x, -transform.parent.position.y, 0f);

  • @redoctober2088
    @redoctober2088 2 ปีที่แล้ว +1

    Hey. I've had many problems with URP so i've decided to try with sprite masks instead - can I somehow pass the Mesh Filter as a sprite to Sprite mask sprite reference?

  • @calvinms7503
    @calvinms7503 ปีที่แล้ว +1

    Hey CM, I have used you CustomFOrwardRenderData but using this making me cannot use the 2D Rendered Data. As a result I cannot use 2D light. Any suggestion?

  • @данет-э5л
    @данет-э5л 6 หลายเดือนก่อน +1

    @CodeMonkeyUnity it seems like u skipped the most important part of this video complitely. (The "Visibility Effect" part from 18:26 to 18:44). What is this LightWeightRenderPipeLineAsset scriptable object adnd how do u create them and what script u type there? Same quastions for CustomForwardRendererData scriptable Object. Also i tried to goolle this things and it seems like unity doesnt have LightWeightRenderPipeLine at all now. Could you please pour some light on this quastions? And how you would recreate this in recent Unity versions? Or may be you even would take complitely diferent approach now (then new video would be rly helpfull ^_^ ♥)? thx in front ♥

    • @данет-э5л
      @данет-э5л 6 หลายเดือนก่อน +1

      Also is the rly no ways to achive same result with regular mask components somehow? without messing up with rendered pipe lines?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  6 หลายเดือนก่อน

      The Lightweight Render Pipeline is the old name for what is now called the Universal Render Pipeline. You can add the same renderer features in URP

  • @lepaz9826
    @lepaz9826 4 ปีที่แล้ว +2

    Can you use this tutorial in a 3d topdown shooter?

  • @MrOfearos
    @MrOfearos 3 ปีที่แล้ว +1

    Hey there! Great tutorial! I wanted to ask you how you would go about turning this line of sight into a collidable object in 2D space (for example creatures can't enter it)? I know mesh colliders are 3D creatures so can't collide with my 2d sprites but i can't find a way to have the line of sight rigid.

  • @namthangnguyen8514
    @namthangnguyen8514 3 ปีที่แล้ว

    Thank you for greate tutorial.

  • @bogumiwyrwa216
    @bogumiwyrwa216 5 หลายเดือนก่อน

    Hello,
    I have tried make Field of View for 3D and it works when player do not move.
    I have problem with SetOrigin and SetAimDirection. Do you have some advices for me?

  • @adeled8833
    @adeled8833 2 ปีที่แล้ว

    thank you so much for your channel

  • @kodaxmax
    @kodaxmax 7 หลายเดือนก่อน

    This doesn't seem to work anymore unfortunately. The raycasts and mesh vectors use world space instead of local it seems. I tried importing the files too with no luck, to make sure it wasnt my mistake.

  • @cadebender7101
    @cadebender7101 3 ปีที่แล้ว +1

    So should I use Universal Render Pipeline for this or HDRP?

  • @aigen-journey
    @aigen-journey 5 ปีที่แล้ว +1

    This might be a stupid question, but why not use lights? for the visual effect (you would also get a nice smooth transition), or a static plane with the light 'cone' taken from a texture?

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  5 ปีที่แล้ว +1

      That depends on what game you're trying to make, for some games a smooth light might be nice, for other games being able to clearly tell how far you can see might be better.
      So the question kind of becomes, do you want a lighting effect or a game mechanic?
      For example in the next video I will apply this effect to the enemies in order to make a very clear enemy view cone, like in Commandos or Desperados, that is perfect for a Stealth game. You can clearly see where you are safe and where you are not.

    • @4randylarson
      @4randylarson 3 ปีที่แล้ว

      @@CodeMonkeyUnity As a general comment, I think this is perfect to combine with lights. If you want a FOV environment then lights that are obscured from the FOV (e.g., behind a wall) should not be visible. Lights, once they are in the FOV would be great to illuminate the area. Following this, your FOV angle could be 360 and this would generate a mesh that was then lit as your lights dictated. I went to Google with a notion of how to generate exactly this. I figured it was mesh related, but the exact mechanics I was unsure of. Thanks for this video and others on you channel. Your insight and presentation are outstanding and super helpful.

  • @ollewahlstrom1936
    @ollewahlstrom1936 4 ปีที่แล้ว +5

    Great tutorial! I'm pulling my hair trying to figure out an issue though. Everything works as long as I have alpha on the material on the field of view gameobject to >0.5 which then shows it very clearly green. any lower than that and the green disappears but then the black layer is rendered instead and no object that are supposed to be show in the mask (fov) are shown and it's just dark... I'm so confused. It doesn't help that there seem to have been a version bump since you did this and the version I have so the custom rendering pipeline has some different settings, not much though.

    • @fartedididnot3685
      @fartedididnot3685 8 หลายเดือนก่อน

      I have the exact same issue. Did you ever find the fix?

    • @jabbathetrump187
      @jabbathetrump187 8 หลายเดือนก่อน

      ​@@fartedididnot3685Did you find a fix?

    • @fartedididnot3685
      @fartedididnot3685 8 หลายเดือนก่อน +1

      @@jabbathetrump187 I actually did! I can't remember exactly but its something like this:
      If you go inside the actual material editor, not sure what its actually called but its a similar look to unreal blueprints.
      There you should be able to change the color to white, and there should also be a 0.5 option there too. Change that to something much lower and the mesh should appear below 0.5 opacity.

    • @inf3243
      @inf3243 2 หลายเดือนก่อน

      @@fartedididnot3685 thankyou!

  • @haramaj6189
    @haramaj6189 3 ปีที่แล้ว +2

    In URP, it works same way. but in latest version, forward renderer has two filtering layer mask instead of default layer mask. i used transparent layer mask.

    • @b_boffix
      @b_boffix 3 ปีที่แล้ว

      Hi, what have you set in Filtering? Wich Layers?

    • @haramaj6189
      @haramaj6189 3 ปีที่แล้ว

      @@b_boffix same as video

  • @narutobutthole
    @narutobutthole 3 ปีที่แล้ว +1

    Hello Code Monkey. I'm having a problem with this code. First I made a grid and when I place my player on said grid the FOV doesn't show up, as in the mesh I made to show the FOV doesn't appear on top of the grid. If I pause the game and click on the FOV in the hierarchy it shows the outline though. However if I take him off the grid it shows up just fine and will work as in intended with the corners of the grid.
    Thank you for your time.

  • @albertozp
    @albertozp 3 ปีที่แล้ว +1

    Fantastic tutorials! I got it going on, although the FOV is mirrored from the cursor's position, and it is only showing triangles drawn with the origin and the vertices created by collisions (vertex at max distance aren't showing somehow). Anyone got any idea on what to check?

  • @radian825
    @radian825 4 ปีที่แล้ว +2

    How did you make this Mask material? If I add a standard material. It is black (although the color is set to green), and not transparent (alpha is set low). When Importing the files of the project the material shows the following error "Hidden/InternalErrorShader".

    • @smoq20
      @smoq20 4 ปีที่แล้ว +2

      Same problem here

  • @ancalagon1144
    @ancalagon1144 4 ปีที่แล้ว +1

    I don't get the render pipeline part. I downloaded the utilities but the mask material is an error and what scripts should I give the lightweight render pipeline and the customforwardrenderer?

  • @khiemnd777
    @khiemnd777 3 ปีที่แล้ว

    This is awesome, does it work well with Unity WebGL?

  • @pcccmn
    @pcccmn 3 ปีที่แล้ว +1

    Dude, what on Earth is your FOV's Shader's settings?

  • @leonardomorselli5265
    @leonardomorselli5265 4 ปีที่แล้ว +4

    I have a problem, i dont have a player to move the field of view since i wanted to use it like a "light source". It doesnt need to illuminate my scene, just to visualize a cone of light. Anyway, if in the scene window (while playing) i try to move it, it didnt update the collisions. So i created an object called light source and attached its transform position to the SetOrigin, which I call every update of the mesh script (the one u showed in the video). It doesnt work, specifically the mesh moves faster than the object, making it like every collision has an offset if i move it. Help pls. If instead I just move the walls it works fine.

    • @jerematic10
      @jerematic10 3 ปีที่แล้ว

      I'm having this same problem, did you ever find a solution?

    • @leonardomorselli5265
      @leonardomorselli5265 3 ปีที่แล้ว

      @@jerematic10 no sorry man

  • @gaerex1334
    @gaerex1334 5 ปีที่แล้ว +5

    Dude, you are just fucking amazing, thank you a lotttttttttt, you kept me helping out from when I started my journey, you are doing amazing work, may God bless you. ❤❤

  • @madamutzsar
    @madamutzsar 4 ปีที่แล้ว +2

    I downloaded the utils for the function and kept getting an error about not being able to convert float to int or something like that, same error even when I DL'd your field of view code. I removed the utils and rewrote the function you show here to my script and it works now. So I'm guessing you've changed something in the utils package on your site since this was made

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 ปีที่แล้ว +2

      I might have modified the function to convert an angle where previously it would round to an int and in this video I really needed a float.

    • @keennness8594
      @keennness8594 4 ปีที่แล้ว

      @Matt Kaiser i dont understand

    • @maow9240
      @maow9240 3 ปีที่แล้ว

      @@keennness8594 in the utils class script this line here
      public static Vector3 GetVectorFromAngle(int angle) {
      // angle = 0 -> 360
      float angleRad = angle * (Mathf.PI/180f);
      return new Vector3(Mathf.Cos(angleRad),0 , Mathf.Sin(angleRad) );
      }
      the line
      public static Vector3 GetVectorFromAngle(int angle)
      the "int" before "angle" needs to be changed to a "float".
      public static Vector3 GetVectorFromAngle(float angle)
      and it looks like he changed the file at some other time to use it for whatever and the file on the website has the int instead of float like in the video

  • @luka_17_63
    @luka_17_63 ปีที่แล้ว +2

    Hey Code Monkey, I modified the Code a bit to work for 3d and on X-Z-Axis and not X-Y-Axiz:
    [SerializeField] private LayerMask fieldOfViewLayer;
    private Mesh _mesh;
    private Vector3 _origin;
    private float _fov = 90f;
    private float _startingAngle;
    private int _rayCount = 50;
    private float _viewDistance = 10f;
    private void Start()
    {
    _mesh = new Mesh();
    GetComponent().mesh = _mesh;
    }
    private void LateUpdate()
    {
    float angle = _startingAngle;
    float angleIncrease = _fov / _rayCount;
    Vector3[] vertices = new Vector3[_rayCount + 1 + 1];
    Vector2[] uv = new Vector2[vertices.Length];
    int[] triangles = new int[_rayCount * 3];
    vertices[0] = _origin;
    int vertexIndex = 1;
    int triangleIndex = 0;
    for (int i = 0; i 0)
    {
    triangles[triangleIndex + 0] = 0;
    triangles[triangleIndex + 1] = vertexIndex - 1;
    triangles[triangleIndex + 2] = vertexIndex;
    triangleIndex += 3;
    }
    vertexIndex++;
    angle -= angleIncrease;
    }
    _mesh.vertices = vertices;
    _mesh.uv = uv;
    _mesh.triangles = triangles;
    }
    private Vector3 GetVectorFromAngle(float angle)
    {
    float angleRad = angle * (Mathf.PI / 180f);
    return new Vector3(Mathf.Cos(angleRad), 0, Mathf.Sin(angleRad));
    }
    private float GetAngleFromVectorFloat(Vector3 dir)
    {
    dir = dir.normalized;
    float angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg;
    if (angle < 0) angle += 360;
    return angle;
    }
    public void UpdateFOV(Vector3 aimDirection, Vector3 origin)
    {
    _startingAngle = GetAngleFromVectorFloat(aimDirection) - (_fov / 2f);
    _origin = origin;
    }
    My Problem ist, that i want the Mesh to be rendered in the facing direction of the character, but somehow, when I am writing in the Update Function of the Character this Code:
    fieldOfView.UpdateFOV(transform.forward, transform.position); It doesn't work.
    Any idea or inprovements? Hope you can help me out:)

    • @angryfoxsmi1751
      @angryfoxsmi1751 11 หลายเดือนก่อน

      Hey, did you come out with a solution?

    • @pereprohens5192
      @pereprohens5192 7 หลายเดือนก่อน

      With your modifications I think you need to change te component of the Vector3 used in the Utils methods (don't use x and y, use z and x instead):
      public static Vector3 GetVectorFromAngle(float angle)
      {
      // angle = 0 -> 360
      float angleRad = angle * (Mathf.PI / 180f);
      return new Vector3(Mathf.Cos(angleRad), 0, Mathf.Sin(angleRad));
      }
      public static float GetAngleFromVectorFloat(Vector3 dir)
      {
      dir = dir.normalized;
      float n = Mathf.Atan2(dir.z, dir.x) * Mathf.Rad2Deg;
      if (n < 0) n += 360;
      return n;
      }
      public static int GetAngleFromVector(Vector3 dir)
      {
      dir = dir.normalized;
      float n = Mathf.Atan2(dir.z, dir.x) * Mathf.Rad2Deg;
      if (n < 0) n += 360;
      int angle = Mathf.RoundToInt(n);
      return angle;
      }
      public static int GetAngleFromVector180(Vector3 dir)
      {
      dir = dir.normalized;
      float n = Mathf.Atan2(dir.z, dir.x) * Mathf.Rad2Deg;
      int angle = Mathf.RoundToInt(n);
      return angle;
      }

  • @hoangpham602
    @hoangpham602 3 ปีที่แล้ว +2

    Hi @Code Monkey, your video is amazing. I followed it and succeeded. However, one problem is that when I make the field of view to be the children of a moving object, when the object moves, the render of the field of view doesn't match with the object's position even though I set origin = transform.position. Can you help me with this issue?

    • @tello_5939
      @tello_5939 3 ปีที่แล้ว +2

      Do:
      vertices[0] = Vector3 . zero;
      for(int i = 0; i

    • @hoangpham602
      @hoangpham602 3 ปีที่แล้ว

      @@tello_5939 Worked like a charm, thank you.
      But still got a problem when I using Mirror with this kind of FOV, this FOV still remain like it was when it was first spawned and can't change the direction. I doubt with this rendering FOV technique, I cannot draw client sync with server

    • @tello_5939
      @tello_5939 3 ปีที่แล้ว

      @@hoangpham602 Happy to help!
      Also, why do you want to sync the fov with the server? Cant that happen client-side?
      Or didnt i understand your problem correctly?

    • @hoangpham602
      @hoangpham602 3 ปีที่แล้ว

      @@tello_5939 Since fov is a child object of the player object, the player object has the network transform attached, so both player and fov are the client and appear on the server. However, when the player changing the direction of the fov, it can only be shown on the client, not on the server. In the server, the fov was stuck in the first direction when it appeared. I tried using network transform child but it still didn't work. It seems that drawing a mesh in update cannot sync with the server

    • @tello_5939
      @tello_5939 3 ปีที่แล้ว

      @@hoangpham602 I've yet to use mirror but from what you said i dont think syncing the transform will suffice since you are not changing the transform of the fov but rather the mesh. Hope that helps but i dont know anything about mirror ^^

  • @creativegeniusgames7543
    @creativegeniusgames7543 6 หลายเดือนก่อน

    Do you have a video regarding how you set up the Black Layer and the CustomForwardRenderData? It's the light and shadow affect I'm most interested in, and how you hide objects using the dark layer, but it seems like I'd need to learn a great deal about Render Pipelines just to implement that one feature?
    I also have weird interactions where the mesh I have draw is either behind or on top of everything in my scene (usually behind), it doesn't seem to follow the same layer rules that sprites and Canvas based objects use?
    I've tried other variations, but the ability to "cut a hole" in one layer/image using the mesh you've demonstrated doesn't work with this code as it would with UI elements or DrawLine

  • @nyncrogmr
    @nyncrogmr 4 ปีที่แล้ว

    Hello and thanks for the video I think it's great. I have a problem though, it seems to bee the object interaction part, it never detects any object. I'm currently using the 2019.4 version. I noticed that your Rendering Mesh has a field to chose a layer inside the additional settings box, mine doesn't, could that be the problem? Or maybe the type of object that I'm using as an obstacle?

  • @timeofjustice4094
    @timeofjustice4094 3 ปีที่แล้ว +1

    When I follow all the steps, I got the problem that the RP ignores the sorting layers of my Sprites and always put the Sprite, with the Layer BehindMask, in front? Does anyone have an idea how to fix it?

  • @xavmanisdabestest
    @xavmanisdabestest 5 ปีที่แล้ว +2

    Amazing tutorial as always code monkey

  • @CORKALOT
    @CORKALOT 4 ปีที่แล้ว +1

    For anyone experiencing issues with Code's latest package on the website go inside the folder Codemonkey > Utils & open the UtilsClass script, find " public static Vector3 GetVectorFromAngle(int angle)" and change "int" to "float".
    Beyond this Code, I'm stuck myself when it comes to shooting rays. I get the mesh displaying correctly when the vertex is defined like this "Vector3 vertex = origin + UtilsClass.GetVectorFromAngle(angle) * viewDistance;" but when it comes to adding the RaycastHit2D and parsing it through the "if" statement the mesh just turns into a straight line only visible by zooming in a lot! Any ideas? I'm on 2019.2.8f1 but I'm not sure why it'd affect rays so drastically. All of the code is exactly like yours.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 ปีที่แล้ว

      Try out with a single ray and check add some Debug.Log's. Check the raycastHit.point to see where its colliding.
      Issue could also be with how you're setting up the triangles, make sure the logic sets them up in the correct order.

    • @CORKALOT
      @CORKALOT 4 ปีที่แล้ว

      @@CodeMonkeyUnity Thanks - still can't find a solution but I'll follow up with screenshots on Discord.

  • @castlecodersltd
    @castlecodersltd ปีที่แล้ว

    Very enjoyable

  • @karllauer3173
    @karllauer3173 3 ปีที่แล้ว

    Can this be extended to a gridless movement range indicator similar to xcom? I guess the biggest problem is, if an obstacle is entirely encompassed by valid range: that would mean having a polygon with a cut hole for the obstacle. any ideas?

  • @Tiparium_NMF
    @Tiparium_NMF 3 ปีที่แล้ว

    I'm doing a similar concept to this for a class project, but I want any object outside of the field of view to leave a sprite behind representing the last known location. Any suggestions?

  • @SujithEnigma777Soman
    @SujithEnigma777Soman 3 ปีที่แล้ว +1

    The fov is moving away from the player when pressing movement keys like wasd

    • @Saleca
      @Saleca 3 ปีที่แล้ว

      try using locaPosition

  • @TheAnonymousLemur
    @TheAnonymousLemur ปีที่แล้ว

    I'm having trouble assigning a color to the Rays. It appears to only allow materials, and when I make one, even if it's transparent, it doesn't assign, there is only one built in swatch (material/color/whatever) that even get's anything to show up.

  • @Alzimovich2
    @Alzimovich2 4 ปีที่แล้ว

    Hi, new Code Monkey addicted here! I have a question: what if instead of recreating the mesh at each LateUpdate we just use the mesh of an object created in blender (as you've done for the sphere around the player)? Is that feasible? Does it provide some performance enhancement?
    Thank you very much, keep up the good work!

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 ปีที่แล้ว

      Not sure what you mean, that would be a fixed mesh and wouldn't adapt to what the player is seeing

    • @DavidB-rx3km
      @DavidB-rx3km 4 ปีที่แล้ว

      The code is using the elements of the six sided mesh to detect every frame, it would miss the point using a standard mesh (and it wouldn't work heh)

  • @hugri915
    @hugri915 3 ปีที่แล้ว +1

    How can make end of the field of view blur ??

  • @shapsl
    @shapsl 2 ปีที่แล้ว

    How do I set up in 2021 version? urp settings

  • @lspremul
    @lspremul 4 ปีที่แล้ว +1

    Hi Code Monkey, I was curious if you have looked into this rendering technique with the 2019.3 URP? I am trying to use that to make it work, but it just seems like none of the Render Features (Mask, Behind Mask, Black) in the pipeline asset are even taking place despite following the setup you showed in the video. Any help would be greatly appreciated!

    • @lspremul
      @lspremul 4 ปีที่แล้ว

      I seem to have gotten it to work now, I needed to change the FieldOfView Shader type to "Universal Render Pipeline/Simple Lit" and now it's working perfectly

    • @tobiacancelliere6972
      @tobiacancelliere6972 4 ปีที่แล้ว +1

      Didn't work for me after the mesh rendering. I don't understand how the FOV material has an alpha setting (mine doesn't), I don't know why the object in the behindMask layer don't disappear, the FOV ray fin is purple.... Does anybody have suggestions? I followed the steps religiously, as close as possible using the URP (as the LWRP has been discontinued apparently) but nothing I do seem to change anything

  • @KevEatsCheese
    @KevEatsCheese ปีที่แล้ว +1

    Could anyone explain to me how to make the vision visual effect work in the more modern versions of Unity? I'm using 2022 LTS, and LWRP is long gone now. Everything else works great!

  • @bluejay7071
    @bluejay7071 14 วันที่ผ่านมา

    does this work in 3D or will I need to adjust it?

    • @Sky_IM
      @Sky_IM 7 วันที่ผ่านมา

      I got it to work in 3D. You have to update the logic for the field of view slightly to work in 3D. I also had to use a plane hovering above the 3D map instead of attaching the black field to the camera. I also followed the tips in the comments as there was some pipeline stuff you need to have set up.

  • @michiblk4581
    @michiblk4581 4 ปีที่แล้ว +1

    Is it possible to let already passed sections stay revealed? I currently make a map where areas which are already were seen is visible.

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 ปีที่แล้ว +2

      For that you need something different that can store what areas have already been uncovered. The simplest way is just a basic grid with a bool for visible or not and visualize by showing or hiding a black visual for each grid position.

  • @tuvokjohannsen123
    @tuvokjohannsen123 4 ปีที่แล้ว +2

    How does this work with the new URP in UNity 2019.3? Messed something up. It worked finde in the previous version, but now I've problems

    • @CodeMonkeyUnity
      @CodeMonkeyUnity  4 ปีที่แล้ว

      I haven't tested it with 2019.3 but the URP is pretty much the same as the LWRP so it should work just fine
      What problems do you have?

    • @TheKacperuss
      @TheKacperuss 4 ปีที่แล้ว

      @@CodeMonkeyUnity Not the same guy and 3 months late but I was also working on 2019.3 with URP. In my experience, for some reason the stencil override option just ticks itself off when running the game, effectively removing all changes. I couldn't find any solutions or even anyone mentioning the problem. Both depth and camera options work just fine, but stencil resets each time you try to run the game.
      I tried it on 2019.2 and I can confirm it works fine, it's not me being stupid. It really seems that something in URP in 2019.3 causes stencil to be... Ignored? Skipped? Reset? Turned off?
      I'm sorry if you already discussed this problem. I couldn't find any of your latest videos being about render pipelines, but maybe I missed something.

    • @FluidicClient
      @FluidicClient 4 ปีที่แล้ว

      @@TheKacperuss I'm having the same issue, apparently there's a bug in the current version of unity. Guess it's a case of waiting for the next build or reverting to an old one.

  • @notanagger4861
    @notanagger4861 ปีที่แล้ว

    my sphere and fov object overlap creating a darker triangle at the space they overlap at, how do I fix this?