Field of view visualisation (E01)

  Рет қаралды 443,813

Sebastian Lague

Sebastian Lague

Күн бұрын

Пікірлер: 466
@SebastianLague
@SebastianLague 9 жыл бұрын
Hi everyone, a quick little two-parter on creating a field of view system for stealth and tds games. Hope you find it useful :) In this first episode we create the main system for detecting objects in our line of sight, as well as a custom editor so we can see what's going on in the editor. In the next episode we'll create a cool effect to visualise the field of view. If you'd like to support my tutorials, I have a patreon page here: bit.ly/sebPatreon
@AkumaRaion
@AkumaRaion 9 жыл бұрын
+Sebastian Lague another great tutorial dude! this was something i need for my project, I made a much simpler version of this with using only raycasts but this one is much better than mine. I was trying to do the same but I'm quite enw to unity editor. I am getting an error with "target" variable you used in FieldOfViewEditor script since I didn't define it. ... Well iI just noticed my editor was still a MonoBehavior script. Maybe someone else might get the same error so I'll leave this here :P
@RaunaqSoni96
@RaunaqSoni96 9 жыл бұрын
+Sebastian Lague This is something I always think when I watch one of your tutorials, HOW AND WHERE do you learn such great stuff from ???
@ibrahimb756
@ibrahimb756 9 жыл бұрын
+Sebastian Lague How do you know all of this ?. Is it by practicing many examples/getting used to them then adding them to your library of features you learned ? Is that enough to gain knowledge/logic to create new methods/ideas over time(which i know will take me at least a year of hard working) ?. Or is that not enough to be a good or great developer ?.... :( I feel so stupid and lost. Every time i learn something hard something more insane appear lol. Also great sources to learn like your channel is very hard to find. xP
@SebastianLague
@SebastianLague 9 жыл бұрын
+Ibrahim A I know how you feel, I've been at this for more than 4 years and there is still an overwhelming amount that I don't know/can't do! Still, with practise and exposure to different problems, one definitely begins to gather insights that allow one to tackle new challenges by oneself. So keep at it and don't worry about feeling lost sometimes, it's quite normal :P Glad you like the channel!
@ibrahimb756
@ibrahimb756 9 жыл бұрын
+Sebastian Lague Thank you ^^. You made me more confident after your replay. :D
@accioollie9710
@accioollie9710 2 жыл бұрын
This tutorial is even better than paid unity assets! Even 7 years later. Amazing tutorial!
@Hazzel31337
@Hazzel31337 2 жыл бұрын
YES i agree still awsome still using it today xD
@mrbruh2460
@mrbruh2460 Жыл бұрын
fr
@h8today
@h8today 5 жыл бұрын
This largely works for 2D as well. In case you can't figure it out, here is some information: Anything done on the Y axis (including transform.up) needs to be changed to the Z axis (transform.forward), and anything on the Z axis needs to be changed (I believe) to the X axis (transform.right). Any Physics or Colliders need to be changed to their 2D counterpart. Collider[] targetsInViewRadius = Physics.OverlapSphere(transform.position, ViewRadius, TargetMask); Becomes Collider2D[] targetsInViewRadius = Physics2D.OverlapCircleAll(transform.position, ViewRadius, TargetMask);
@sketh7092
@sketh7092 4 жыл бұрын
You are a savior, my friend. Really appreciate this advice, this will save me tons of time that I would have wasted on searching for solutions online.
@Danee2108
@Danee2108 4 жыл бұрын
I can't get it to work :(
@rendeer8822
@rendeer8822 4 жыл бұрын
Hey and also in the part with angleInDegrees += transform.eulerAngles.y; Should be in 2d as angleInDegrees -= transform.eulerAngles.z;
@sharkk244
@sharkk244 4 жыл бұрын
@@rendeer8822 and on the editor script what i should put?
@rendeer8822
@rendeer8822 4 жыл бұрын
@@sharkk244 There's not much you need to change except for the line in the video that says Handles.DrawWireArc(fov.transform.position, Vector3.up, Vector3.forward, 360, fov.viewRadius Should be changed into Handles.DrawWireArc(fov.transform.position, Vector3.forward, Vector3.right, 360, fov.viewRadius
@YulRun
@YulRun 2 жыл бұрын
My god I've followed your stuff for a few years, and stumbled on this old video, still a gem. This has so many applications for using this calculation.
@binarystateofmind2971
@binarystateofmind2971 4 жыл бұрын
Sebastian as always you make the best tutorials, that help even 5 years later. Thank you for that
@echodev7318
@echodev7318 3 жыл бұрын
Thanks for confirming this still works
@pedicagames3729
@pedicagames3729 7 жыл бұрын
It was one of the best tutorial videos I've ever seen. 1) Smooth expression. 2) First creates a problem, then solves that problem. Much better. 3) No unnecessary talk. Now I will look at the other videos. Thanks.. you deserve to make money :)
@justmark8040
@justmark8040 9 жыл бұрын
Your videos are amazing. It's 3:30 am and I'm still watching you. Your explanations are very entertaining even if you're explaining boring stuff :D
@philliptemidayo
@philliptemidayo 7 жыл бұрын
Just Mark lol
@Sisyphus.
@Sisyphus. 5 жыл бұрын
yeah it's relaxing
@asclepiiusunknown1090
@asclepiiusunknown1090 4 жыл бұрын
This is amazing even today, and I find it super useful even to add into your top down shooter tutorial.
@thatonedude-6819
@thatonedude-6819 3 жыл бұрын
How about today
@whiteline4157
@whiteline4157 3 жыл бұрын
@@thatonedude-6819 This is amazing even today, and I find it super useful even to add into your top down shooter tutorial.
@thatonedude-6819
@thatonedude-6819 3 жыл бұрын
@@whiteline4157 but like… what’s about *today*
@whiteline4157
@whiteline4157 3 жыл бұрын
@@thatonedude-6819 This is amazing even 19/09/2021, and I find it super useful even to add into your top down shooter tutorial.
@thatonedude-6819
@thatonedude-6819 3 жыл бұрын
@@whiteline4157 lol
@h3llmepone
@h3llmepone 8 жыл бұрын
Awesome tutorial. Thanks for the excellent explanations. I was trying to do this, but just with multiple raycast and other crazy things, but this is much better. Now I just have to read all the scripts almost 5 more times to understand everything... _=D
@grepme2001
@grepme2001 7 жыл бұрын
Thank you so much! I've been puttering around for days trying to constrain the turrets to a firing arc on the ships in my little free scrolling shooter prototype and this adapted perfectly! I've been cutting my teeth on this stuff for a few weeks now and you've provided quantity and quality of insight an order of magnitude above any other I've found. Again, thank you.
@midniteoilsoftware
@midniteoilsoftware 2 жыл бұрын
All of your tutorials are fantastic! Clear, concise, and to-the-point. I hope to reach that level with my tutorials.
@habsi70
@habsi70 8 жыл бұрын
For those interested in seeing the only the viewAngle and not the whole circle in the editor (shows only the form of a pizza-slice) - a small adaption of FieldOfViewEditor.OnSceneGUI: void OnSceneGUI() { FieldOfView fow = (FieldOfView)target; Handles.color = Color.white; Vector3 viewAngleA = fow.DirFromAngle(-fow.viewAngle / 2, false); Vector3 viewAngleB = fow.DirFromAngle(fow.viewAngle / 2, false); Handles.DrawWireArc(fow.transform.position, Vector3.up, viewAngleA, fow.viewAngle, fow.viewRadius); Handles.DrawLine(fow.transform.position, fow.transform.position + viewAngleA * fow.viewRadius); Handles.DrawLine(fow.transform.position, fow.transform.position + viewAngleB * fow.viewRadius); }
@rvv27
@rvv27 6 жыл бұрын
Sebastian Lague is the master for the Expert Unity Tutorials on KZbin. Not those high trafficked easy peasies
@razorback9999able
@razorback9999able 4 жыл бұрын
To draw wire arcs in 2D, use this: Handles.DrawWireArc(fow.transform.position, Vector3.forward, Vector3.right, 360, fow.viewRadius);
@darkergood5248
@darkergood5248 4 жыл бұрын
Thanks man. U r a savior.
@mrss649
@mrss649 4 жыл бұрын
Thanks!
@fleksyy
@fleksyy 4 жыл бұрын
+ If you have troubles with the inner FOV on 2D you should change z and y in the returned Vector3 of DirFromAngle
@blaqkstar
@blaqkstar Жыл бұрын
Man, thank you so much. This was killing me
@lazypug-hayud
@lazypug-hayud 9 ай бұрын
thanks a lot man i love you
@rogers5887
@rogers5887 9 жыл бұрын
I've been looking for a tutorial for this type of mechanic for a long, long time. Many thanks Sab and Merry Christmas/Boxing day!
@mrss649
@mrss649 4 жыл бұрын
Hello
@channel_moved9619
@channel_moved9619 8 жыл бұрын
Just made the most advanced AI I've made, line of sight, patrolling and losing interest in the player as well as reacting to sound, and investigating sounds. Amazing tutorial explained really well.
@purpleice2343
@purpleice2343 8 жыл бұрын
How does it react to sound? Actual sound or just self made sound radius for steps and etc?
@channel_moved9619
@channel_moved9619 8 жыл бұрын
Sorry for the late reply. It detects sound in a simple way. Firstly, instead of using PlayOneShot, I instantiate an audio object that uses Play after it sets the clip to the audio clip I gave. This way the clip is stored in the game object until it's destroyed. When a sound is played, a function is called in the ai that checks the sound name, audio source volume, and range. Depending on these parameters it will either investigate or leave it alone.
@ZandreAiken
@ZandreAiken 3 жыл бұрын
Just found this tutorial. This is exactly what I needed. Great video series. Thanks, Sebastian.
@simeondoesstuffbg3881
@simeondoesstuffbg3881 6 жыл бұрын
I’m working on a Plants Vs Zombies style game lately and this was Very helpful in getting my turrets to properly detect enemies on their lane. Thank you very much.
@hunterongames77
@hunterongames77 6 жыл бұрын
Sebestian, As always a great tutorial with clear explanations, diagrams, and setup. Very fast, but then we can always pause in KZbin. I'd hate to be your student in a real classroom at this speed, though. LOL.
@jeffreycordova9082
@jeffreycordova9082 8 жыл бұрын
Thanks for the great videos Sebastian. I always find myself coming back, these are great to use for references.
@Mark21084
@Mark21084 4 жыл бұрын
Thanks for the great explanation!! This is exactly what I was looking for
@Terak47
@Terak47 3 жыл бұрын
This is a fantastic tutorial, exactly what I was looking for. Well documentation, explained, and the downloadable assets are great. Thank you!
@Inf4mousKidGames
@Inf4mousKidGames 3 жыл бұрын
You know this is actually quite useful for my studies. I've been trying to figure out how to do aim assist for a shooter game I'm making and the field of view system here might be what I need
@Jointknight
@Jointknight 7 жыл бұрын
Wonderfully applicable work, thank you kindly taking the time to do these demos!
@newsystem3667
@newsystem3667 6 жыл бұрын
I'm 13 minutes in and this looks really advanced, but i love it
@EpicSqu1rrel
@EpicSqu1rrel 7 жыл бұрын
Seriously underrated unity tutor, should have way more subs and likes! great vid, you're a genius
@lvx969
@lvx969 9 жыл бұрын
This is awesome! Can't wait for part 2.
@mrss649
@mrss649 4 жыл бұрын
Did you ever find one? I can't find it.
@lvx969
@lvx969 4 жыл бұрын
@@mrss649 kzbin.info/www/bejne/bWSnlGiAiaiggas
@mrss649
@mrss649 4 жыл бұрын
@@lvx969 thanks!
@lvx969
@lvx969 4 жыл бұрын
@@mrss649 No problem :)
@mrss649
@mrss649 4 жыл бұрын
@@lvx969 :)
@jumpman23nith
@jumpman23nith 3 жыл бұрын
This is amazing! Thank you so much for sharing this. Clear and concise.
@DynaZor
@DynaZor 5 жыл бұрын
Two tips on optimizing the code: Cache all the components you reference more than once, such as transforms. Instead of DIVIDING by 2, MULTIPLY by 0.5, it seems to be less taxing. Have a nice day :)
@KaletheQuick
@KaletheQuick 8 жыл бұрын
This is like the 3rd time I have been here for this Coroutines are at 19:20 Go there to see how to set up a coroutine. Thumb this up. Thanks Sebastian!
@dungooooo
@dungooooo 3 жыл бұрын
This is just what I needed. Thanks so much for a helpful video that works perfectly and totally understandable!
@grumpyoldman7166
@grumpyoldman7166 4 жыл бұрын
I took your code and added the ability to see over walls and other obstacles. Basically add an object at eye level to raycast from on the source object and add a "head" object to serve as the target.
@abdou023
@abdou023 7 жыл бұрын
Perfect. keep doing tutorials about mechanics like this please.
@_daniel.w
@_daniel.w Жыл бұрын
Saving this for later, this is going to be really useful for me. Appreciate it!
@DitlevIs
@DitlevIs 3 жыл бұрын
Oh, this is very impressive! It sure helped me a lot! Thanks!
@Oxmond
@Oxmond 4 жыл бұрын
Wow. Really, really nice field of view tutorial! Well done! 👍🤓
@NevaranUniverse
@NevaranUniverse 9 жыл бұрын
Again a stellar work with the tutorial - nice job!
@rizuoo
@rizuoo 4 жыл бұрын
Fantastic stuff as usual! One thing I was wondering is how to add 'layers' to the field of view like in traditional tactics game - where the first layer is within direct line of sight of an AI character. And a second layer where different conditions apply for detection (e.g. crouching, behind obstacles etc.)
@Mishaboy2010
@Mishaboy2010 5 жыл бұрын
For those of you that want the FOV circle to rotate with the object it is attached to use this: Handles.DrawWireArc(_fov.transform.position, _fov.transform.up, -_fov.transform.right,360, _fov._viewRadius);
@dragonG50
@dragonG50 5 жыл бұрын
Hey, THAT YOU! Do you know if I can rotate the lines with the circle as well?
@Mishaboy2010
@Mishaboy2010 5 жыл бұрын
​@@dragonG50 I am still trying to work that out myself :(
@appledev4637
@appledev4637 9 жыл бұрын
Great stuff! Thank you!!! Extremely informative!
@FaithStudioTeam
@FaithStudioTeam 7 күн бұрын
Best ever unity tutorial 😃 love it
@rameezsafdar6563
@rameezsafdar6563 4 жыл бұрын
Finest tutorial ever! More Power to you.
@lucasgabrielbica9715
@lucasgabrielbica9715 7 жыл бұрын
Sos un genio! Apenas se algo de ingles y pude entenderte sin ningún problema! Gracias!
@hgopikrishnan
@hgopikrishnan 5 ай бұрын
Thanks for this useful tutorial. I had one issue in my game when the enemy is standing on a carpet and the player is at floor, it is is not detecting the player. I slightly increased the ray cast transform's y value and it works in my case. Thanks again for the help 👏👍
@pourliver
@pourliver 9 жыл бұрын
I really like your video! I'd like to see a video where you could show how to use the integrated Unity Networking system.
@MrGamer-ej8xj
@MrGamer-ej8xj 8 жыл бұрын
What a informative video.......amazing......thanks man.................you saved my time.
@pablosuarez9211
@pablosuarez9211 2 жыл бұрын
i shall name my first child after you, you golden god
@diyguild1327
@diyguild1327 3 жыл бұрын
Great tutorial! Took me a minute to get it to work as I think there is some legacy code in here instead of using [SerializeField] (I don't think it was implemented when the tutorial was made). If anyone is having a hard time getting the ray to show up, you need to generate the mesh for it to show up. So what I did was go into the Character and under the Field of View Script, you have the option to "View Mesh Filter." To get this to work, I made a game object and randomly placed a cube off to the side of the map. Then I created a material for the object, make sure to turn the alpha value all the way up to make it invisible (it will still be visible in the editor, but in the playmode it will dissapear.) Then go back and select the "View Mesh Filter" and add the game object you created and it should render a transparent mesh with the red ray visble.
@Zanktus
@Zanktus 2 жыл бұрын
I am not really sure what you mean with legacy code. I took the code 1:1 in the newest 2021 Unity version and everything works out of the box. SerializeField and so on is not really new at all.
@dcy3223
@dcy3223 8 жыл бұрын
Hey Sebastian, your awesome tutorial help a lot, thank you !!!
@ritriviaiv8675
@ritriviaiv8675 7 жыл бұрын
Ty this made some thing so much easyer now. really thank you
@joaozin003
@joaozin003 2 жыл бұрын
Timestamp: 7:07
@kachhadjagdish6812
@kachhadjagdish6812 7 жыл бұрын
Your videos are amazing i like it and most usefull for me. thank you.
@lukesapir1590
@lukesapir1590 3 жыл бұрын
return new Vector3(Mathf.Sin(angleDegrees * Mathf.Deg2Rad), 0, Mathf.Cos(angleDegrees * Mathf.Deg2Rad)); ... I'm very grateful for this line of code!!! Thank you so much!!!
@pharos640
@pharos640 3 жыл бұрын
You are the best this tutorial helped me a lot!
@raigami_san
@raigami_san 9 жыл бұрын
You're awesome man!! You're talented!! I love it...
@gotbaka3
@gotbaka3 Жыл бұрын
Great little video, very useful
@Thavernios
@Thavernios 6 жыл бұрын
Blowed my mind... A lot, actually because i suck a lot at math.
@levyadams1225
@levyadams1225 8 жыл бұрын
Dude, you are amazing. Thank you.
@nathancongdon248
@nathancongdon248 Жыл бұрын
Make sure y'all type "IENumer-ator, and NOT "IENumer-able". I spent 10 minutes trying to figure out what broke my code before finding that mistake...
@pureatheistic
@pureatheistic 2 ай бұрын
Side note, if you make this mistake, it's worth the effort to learn what the difference is and why it exists.
@TripleCreeper3
@TripleCreeper3 2 жыл бұрын
didnt understand a single word but i think it's a good video
@jthespacec
@jthespacec 9 жыл бұрын
That's fantastic! Thanks Seb! How is it for performance, though? Would doing this for multiple gameObjects at once slow things down? That's a lot of raycasts!
@davidkrivan4704
@davidkrivan4704 4 жыл бұрын
Thank you very much for this, very helpful.
@moduntilitbreaks
@moduntilitbreaks 4 жыл бұрын
Watching it with .5 speed and trying to follow :)
@mrss649
@mrss649 4 жыл бұрын
Lol
@rik0904
@rik0904 6 жыл бұрын
i was looking for some thing similar to this, thx for puting code in github
@VGamingJunkieVT
@VGamingJunkieVT 7 жыл бұрын
Is this tied to a previous tutorial? Unity's telling me "The name `target' does not exist in the current context"
@SebastianLague
@SebastianLague 7 жыл бұрын
target is part of the Editor class. Does your script inherit from Editor?
@antonpolchenko6391
@antonpolchenko6391 9 жыл бұрын
Thank you just what I looking for.
@futoadam7254
@futoadam7254 6 жыл бұрын
Great tutorial! Thank you very much!
@rgaryfugate
@rgaryfugate 9 жыл бұрын
Awesome! Needed something like this. thanks.
@RahulOne1
@RahulOne1 7 жыл бұрын
@Sebastian Lague Why you have included camera's y position in the script while calculation ScreenToWorldPoint @5:32 in the video?
@jazzling
@jazzling Жыл бұрын
among us video awesome 10/10 love it best video on KZbin
@jackbenfu
@jackbenfu 5 жыл бұрын
Awesome work! Many thanks :)
@thejestersshow978
@thejestersshow978 3 жыл бұрын
Sebastian : So were going to be using trigonometry Me: ... I just started geometry...
@pauloloureiro9944
@pauloloureiro9944 6 жыл бұрын
@Sebastian Lague | Thanks for your great tutorials! I hope you make anytime a "fog of war" tutorial.
@prakharsaxena4460
@prakharsaxena4460 6 жыл бұрын
I dont know about the audience you are targetting, but for some of the important lines of code; you are going a little fast with lack or less of explaination.. For everything else, its a great tutorial..
@cyco3oy
@cyco3oy 8 жыл бұрын
awesome presentation, thx a lot!
@KnightoftheSorryFace
@KnightoftheSorryFace 5 жыл бұрын
I just watch these cause it's cool to watch. I don't take anything in at all
@Sisyphus.
@Sisyphus. 5 жыл бұрын
i dont know are u sick or something if u say something is cool u think is good what u are saying dosent make sense
@KnightoftheSorryFace
@KnightoftheSorryFace 5 жыл бұрын
@@Sisyphus. I don't take anything at all. Is not me making a negative comment on it. I'm saying that the only reason I watch is because cool and that I don't take in any of the stuff
@Sisyphus.
@Sisyphus. 5 жыл бұрын
@@KnightoftheSorryFace man i forgot what u said before but i didn't mean like that but if something is cool for u it has to be good and u changed ur comment
@KnightoftheSorryFace
@KnightoftheSorryFace 5 жыл бұрын
@@Sisyphus. "You changed your comment" except it is clear that I haven't edited it at all if you'd look to see there is no mark to say it is edited
@RaviPal-pp2pc
@RaviPal-pp2pc 4 жыл бұрын
code till 7:07 is not working completely for me. Character do not follow the cursor but turn to the cursor points. can anyone help on it
@AurelianoShowsTheWorld
@AurelianoShowsTheWorld 3 жыл бұрын
Thx for this tutorial! I've reused it in my «Among Us Clone» pet project :) Trying to break into game dev.
@KeyTryer
@KeyTryer 6 жыл бұрын
Great tutorial. This concept isn't very easy to find around.
@workshopoleg5661
@workshopoleg5661 4 жыл бұрын
I have an issue, Line is drawning while i am In the radius + Angle sight/ How can make scope vision only at view angle???
@horussolis9577
@horussolis9577 7 жыл бұрын
u r so much better than brackeys
@DawnosaurDev
@DawnosaurDev 7 жыл бұрын
I think they are both really good!!
@horussolis9577
@horussolis9577 7 жыл бұрын
me too. brackey's is good but damn sebastian is in a whole other lague of his own
@tvash836
@tvash836 7 жыл бұрын
And the 'Best comment of the day' ward goes to...
@purpleice2343
@purpleice2343 8 жыл бұрын
Yeah lists show up, the only time they don't is when you store classes in them, which aren't marked as serializable by default, well or anything else like that, I think colour also can't be serialized unless marked, and can't be saved into binary file.
@diliupg
@diliupg 6 жыл бұрын
you are an excellent instructor. If you do a course at Udemy I will surely buy.
@blubehriluv
@blubehriluv 4 жыл бұрын
I can't thank you enough
@omerfsa
@omerfsa 8 жыл бұрын
Thanks it's really usefull tutorial.
@joshsavage8659
@joshsavage8659 7 жыл бұрын
Really like your videos!!
@tiagorodrigues_br
@tiagorodrigues_br 5 жыл бұрын
Thanks, that tutorial is amazing!
@Epsio0
@Epsio0 5 жыл бұрын
is the if statement at 17:12 actually correct? In my version of the project it seems to ignore the angle of the field of vision. What's happening is that the object I'm trying to test with could be behind the player yet it would still trigger it as being in the field of vision despite having this if statement in
@Chrisbrei2502
@Chrisbrei2502 2 жыл бұрын
That's so cool! Thank you!
@Jaosen
@Jaosen 2 жыл бұрын
There is a change in the Unity Editor where you do not need to make an Editor folder for custom editors. If in your FieldOfView script you add "using UnityEditor;" and then make a separate class either inside the FieldOfView class or outside it will work all the same. Though if you want to be more organized then the Editor folder would be the way to go.
@Insajdo
@Insajdo 8 жыл бұрын
Hey, great work, I love your tutorials! One quick question, does this work with 2D perspective and sprites?
@SebastianLague
@SebastianLague 8 жыл бұрын
+Insajdo Not out of the box, but it's relatively easy to adapt. (Requires changing some axes, using 2d raycast etc). I'll happily make a tutorial on getting it to work in 2D if it's something people are interested in/struggling with.
@Insajdo
@Insajdo 8 жыл бұрын
+Sebastian Lague I'll try it myself, thanks for your answer :)
@keyankenney
@keyankenney 8 жыл бұрын
I'd like to put in a +1 for a 2D version! Trying desperately to convert, but I'm struggling to get it right. All your tuts are awesome, love your work! Thanks.
@chntnshrff
@chntnshrff 7 жыл бұрын
Hi, this was amazing, I am trying to use this in my 2D project... and I am stuck. Here is what I did... In Editor Script: Handles.DrawWireArc(fow.transform.position, Vector3.back, Vector3.right, 360, fow.viewRadius); In FieldOfView Script float angle = transform.eulerAngles.z - viewAngle / 2 + stepAngleSize * i; Getting angle from x and y axis public Vector3 DirFromAngle(float angleInDegrees, bool angleIsGlobal) { if (!angleIsGlobal) { angleInDegrees += transform.eulerAngles.z; } return new Vector3(Mathf.Sin(angleInDegrees * Mathf.Deg2Rad), -Mathf.Cos(angleInDegrees * Mathf.Deg2Rad), 0); } Used overlap circle instead of sphere Collider2D[] targetsInViewRadius = Physics2D.OverlapCircle(transform.position, viewRadius, targetMask); Changed all to Physics2D, RaycastHit2D and Collider 2D. I think I have missed something...your help will be much appreciated.
@JMYChannel
@JMYChannel 7 жыл бұрын
hi! nice tutorials! I try this into 2D perspective, already try change the axes. But I can't find any target within radius. any suggestion?
@fern092
@fern092 6 жыл бұрын
At 7:17 my Character follows the mouse, but it does not rotate/turn. It keeps the same 90 degree angle. What am I doing wrong: Have I missed some code? I am using a standard mouse.
@fern092
@fern092 6 жыл бұрын
Setting the Global/Local tool handles to Local aligns to the Character itself.
@dracolicha
@dracolicha Ай бұрын
Puedo usar parte de tus video para explicar el concepto de FOV en mis proyectos?
@huntserston3579
@huntserston3579 5 жыл бұрын
Hey I just want to say I love this and plan on using this for custom 2d lighting just wondering if theres a way to make it effect sprites.
@asclepiiusunknown1090
@asclepiiusunknown1090 4 жыл бұрын
Did you end up finding its uses as a light source? I'm trying to do the same and use it to achieve an effect like in Thomas Was Alone
@huntserston3579
@huntserston3579 4 жыл бұрын
@@asclepiiusunknown1090 I did! It sort of worked but requires alot of colliders
@asclepiiusunknown1090
@asclepiiusunknown1090 4 жыл бұрын
Huntsers TON that’s awesome, thanks for actually replying
@huntserston3579
@huntserston3579 4 жыл бұрын
@@asclepiiusunknown1090 np
@only4gamersdev
@only4gamersdev 11 ай бұрын
Episode 02: kzbin.info/www/bejne/bWSnlGiAiaiggassi=RrM0xpTCmKC96z0Q Episode 03: kzbin.info/www/bejne/rpzGdIqnnsuHb68si=eehb9ubRK4nHGBy1
@prometheus625
@prometheus625 3 жыл бұрын
Very late to the party on this one, but would it be more effective to add a mesh collider trigger to your procedural mesh in order to detect enemy in vision instead of a raycast? That way you'd be able to see the edge of them instead of just the centre.
@adilsonv77
@adilsonv77 Жыл бұрын
Wonderful tutorial... it saved me a lot of time. Next, I have a question: when the object in the target mask is very close to the owner of the field of view, it is no longer able to perceive its presence... as well as, when it moves further away, it is no longer recognized. Any suggestions?
@redsan16-78
@redsan16-78 3 жыл бұрын
For those (like me) that do not get the FieldOfViewEditor script to work: input into the top of your script: " using UnityEditor", he has this option already enabled in his script. It was not enabled for me so Unity did not recognize the editor file handler.
@TheKr0ckeR
@TheKr0ckeR Жыл бұрын
Great! How can we calculate Camera's rotation with the aim function? If our camera is not 90 degree; it will be changing our X value of rotation since camera is angled.
@haithammahmoud6825
@haithammahmoud6825 8 жыл бұрын
thanks man i was looking for it
Path Creator (free unity tool)
10:29
Sebastian Lague
Рет қаралды 414 М.
Field of view visualisation (E02)
27:23
Sebastian Lague
Рет қаралды 161 М.
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 9 МЛН
Accompanying my daughter to practice dance is so annoying #funny #cute#comedy
00:17
Funny daughter's daily life
Рет қаралды 28 МЛН
I Spent a Week Making an AI's Video Game Idea
17:51
Sebastian Lague
Рет қаралды 3,2 МЛН
Recreating Darkwood's Vision Effect in Unity
4:01
aarthificial
Рет қаралды 51 М.
Coding Adventure: Rendering Fluids
58:41
Sebastian Lague
Рет қаралды 379 М.
I Made an Electronic Chessboard Without Turns
14:32
From Scratch
Рет қаралды 826 М.
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 747 М.
The Manim Experience - Creating animations with Python
38:51
2 Years of C++ Programming
8:20
Zyger
Рет қаралды 85 М.
Commandos Cone of Sight FX in Unity  | GPUMAN
7:29
GPUMAN
Рет қаралды 7 М.
Coding Adventure: Solar System
12:12
Sebastian Lague
Рет қаралды 867 М.
Coding Adventure: Atmosphere
22:00
Sebastian Lague
Рет қаралды 1,1 МЛН