This tutorial was insane. I can usually work most stuff out myself but this was a blessing. Thanks! churr!
@TheKiwiCoder3 жыл бұрын
You’re welcome Poole!
@laurencealcantara5475 Жыл бұрын
ako rin tol naging insane dahil dito gagoo
@nicoh68193 жыл бұрын
Great tutorial! Used it for my the AI of my fps game. I tried field of view visualisation trough Raycasting before but I had a lot of performance issues that way. Also i wasn't able to have it extended on the y-axe. I modified this code to that way so it's like a real eye. The sight gets higher the further it goes which isn't important if all objects are on the same height but essential in fps games. I reduced the height of bottomCenter and topCenter to Vector3.up * -1 and also moved the y-coordinate of bottomLeft and bottomRight with Vector3.up * (-1/2 * height -1) so the view isn't only going up but also down.
@TheKiwiCoder3 жыл бұрын
Awesome they are some nice improvements!
@24-7-valorant42 жыл бұрын
game link ? 😒😒
@Killerkraft9756 ай бұрын
You cant tell how much time you saved me trying to figure this out on my own. Thank you very much
@zartl102 жыл бұрын
I can't thank you enough mate. Code is beyond my skill level, but not so much that I can't understand and further study it; and it was incredibly easy to implement into my own AI controller code. Thank you SOOO so much!
@yukannasenshi51724 ай бұрын
I can't tell you how much I appreciate this, it helped me so much, thank you!!
@blipblub24193 жыл бұрын
woah, you can box select in visual studio? ps. for those also unaware of this feature, hold alt + shift after initiating a selection.
@dripyman61463 жыл бұрын
I havent started following this series yet becouse of your tps one lol but this will be sooo usefull thank you!
@TheKiwiCoder3 жыл бұрын
lol no worries! They will be ready and waiting. Good luck!
@adeveloper71843 жыл бұрын
Best tutorials on tps and AI, keep going mate! ;)
@TheKiwiCoder3 жыл бұрын
Thanks man 👌
@tedsmall53603 жыл бұрын
Psychedelic pizza slices! Great stuff, love your humor!
@TheKiwiCoder3 жыл бұрын
Haha you made it! Cheers Ted!
@davids32823 жыл бұрын
Thanks for this awesome tutorial!
@mhrohan9173 жыл бұрын
I just love this @TheKiwiCoder. Hopefully This Channel Becomes The Next Brackeys. I mean more Subscriber and lots of content. And by the way, did you participate in the Game Jam?
@TheKiwiCoder3 жыл бұрын
Thank you! Ahh game jams.. the old coke and pizza partys. It’s been a while since I’ve done one!
@artursoares863 жыл бұрын
Excelent! Thank you very much for this lesson!
@thegames7038Ай бұрын
Cool, really helpful
@willydevz2 жыл бұрын
Hey i have a problem. If the player walks in the view it gets spotted but if he walks out its still spotted do you know why this is happining?
@ty-xq7bl3 жыл бұрын
I've been trying to follow this video for two hours now but I just can't seem to get the Scan function to pickup any collider. The triangle mesh shows up properly in my scene but the count function is 0 for this code: count = Physics.OverlapSphereNonAlloc(transform.position,distance,scanned,~ignoreLayer,QueryTriggerInteraction.Collide); What I don't understand is that there is no reference to the triangle mesh built anywhere. Is OverlapSphereNonAlloc creating the triangle? Thanks in advance. UPDATE: I get it now you are casting a sphere around the character then determining it with the triangle mesh. I switched to Physics.OverlapSphere and it started detecting colliders so i'll stick with that. thanks!
@letisschiller51853 жыл бұрын
thanks had the same problem.
@nitro5gaming4632 жыл бұрын
im having an error, can u tell me what to do? Assets\game\scripts\AISensor.cs(45,25): error CS1501: No overload for method 'OverlapSphere' takes 5 arguments edit: i removed colliders and now my code is this: count = Physics.OverlapSphere(transform.position, distance, layers, QueryTriggerInteraction.Collide); but i get this error now: Assets\game\scripts\AISensor.cs(45,17): error CS0029: Cannot implicitly convert type 'UnityEngine.Collider[]' to 'int'
@aniketashis6703 жыл бұрын
Ohhan keep it going very helpful 🔥❤️
@TheKiwiCoder3 жыл бұрын
Thanks!
@Whitewolfgaming2 жыл бұрын
im getting 2 errors at the end of the scan overlay section, error cs1501: no overload for method OverlapSphere takes 5 arguements and error CS0165 use of unassigned local variable 'i'
@sdev61242 жыл бұрын
Many thanks for your guide. I have a problem, when I build the game, the color of the sensor doesn't show up even though I can still scan other objects. If you know then tell me how to fix it. thanks a lot
@LostSol25 Жыл бұрын
You're a legend! How was the process coming up with the logic?
@vlogershloger76086 ай бұрын
Can this tutorial be followed even if I don't have Weapon Pickup script?Because I wanna make a horror ai who's looking for the player. PS:I'm new with Unity and developing😂
@VanessaE-hm7cv Жыл бұрын
where did the layer pickup came from? i dont have it
@XxAnaoGuerreroxX Жыл бұрын
Great video, it helped me do exactly what I wanted. I was just wondering, would it be too hard to add an Enum to switch from horizontal (as demonstrated on the video) to vertical? I am working on a 2.5D game, and it would fit perfectly, but if I rotate the FOV object, the detection does not work properly.
@TheKiwiCoder Жыл бұрын
Hey shouldn’t be too hard. If you replace occurances of Vector3.Up/Forward etc with transform.up/forward etc then you should be able to rotate the game object however you like. Thanks for the idea!
@thebulletkin83938 ай бұрын
Does this essentially serve the same purpose as holding a reference to the player, checking the distance, then using the dot product to find the angle with a raycast to finish it off? I've been looking around to see if there are any other potential ways of doing it but they all seem to follow a similar method
@TheKiwiCoder8 ай бұрын
The sensor volume can be attached to any character (player or Ai) to capture a set or arbitrary objects in view, which could include players, Ai, pickups, or other points of interest
@theashbot40972 жыл бұрын
i am trying to follow this tutorial, but i am getting this error "NullReferenceException: Object reference not set to an instance of an object"
@vick35542 жыл бұрын
Please can you make a video on Menu screen where you can change all post processing settings using URP
@ahmadgamal95873 жыл бұрын
Can this be used as dynamic range which means for example if player is hidden agent can't see him without using mesh
@TheKiwiCoder3 жыл бұрын
Hey yes, you can use this to detect if the agent can see the Player.
@ahmadgamal95873 жыл бұрын
@@TheKiwiCoder I know but what if player is behind a wall or something
@TheKiwiCoder3 жыл бұрын
@@ahmadgamal9587 yes it handles that too, check section: 16:08
@aquafina2on2172 жыл бұрын
The video was very good but i keep getting this error. Gizmos.DrawMesh requires a mesh with positions and normals how do i fix it?
@Randommmszz7 ай бұрын
i doubt you still need help but the way i fixed it was adding mesh.RecalculateNormals(); instead of whatever you wrote with the autocorrected hah
@rakyb12 Жыл бұрын
Can this be applied to 2D without using height/z axis?
@mrthaw52402 жыл бұрын
Can you do the tutorial about automatic position points generating on map and AI position picking system for AI shooter?
@BlackJar722 жыл бұрын
Interesting. I've been using a dot product to allow mobs to see in a hemisphere in front of their eyes.
@Crocc1018 ай бұрын
how would i make so the ai can tell what tag the player has?
@TheKiwiCoder8 ай бұрын
Tags can be read from the game object
@grp60732 жыл бұрын
Great tutorial but I've got a problem. It always gives me an error that says "IndexOutOfRangeException: Index was outside the bounds of the array. Eye.CreateWedgeMesh () (at Assets/Scripts/Eye.cs:83) Eye.OnValidate () (at Assets/Scripts/Eye.cs:95)" Is there any way to fix this problem?
@ogulakol627910 ай бұрын
same
@echodev73183 жыл бұрын
so, i am getting a small error where the top side of the mesh doesnt render, does anyone know how to fix this
@svedalawoodcrafts2 жыл бұрын
The problem Im having is the AI enemy will walk forward a couple of meters and just stop, will not chase or shoot. tripple checked the code, set all ground and walls correctly. Once it stops it unchecks the script from the object which is weird and also if I recheck the script to active and move the ai enemy around a little bit he will chase the player but not shoot.
@maazbinshahid649 Жыл бұрын
Instead of manually calulating the position of the gameobject and compare it to check if it is in the sensing range or not why didnt you put a trigger on the mesh and used onTriggerEnter
@TheKiwiCoder Жыл бұрын
I wanted to have more control over how frequently the sensor was checking for objects. I suppose I could have disabled/enabled the trigger component but felt like doing it by hand instead :)
@oblo49523 жыл бұрын
I probably just made a dumb mistake, but Im getting lots of errors on the first code The words Quarternions, meshColor, vertices, bottom center, and bottom left "don't exist in the current context"
@blipblub24193 жыл бұрын
im gonna guess typos if that is the exact syntax you used
@masterreeses3 жыл бұрын
No errors but the wedge isn’t appearing. What?
@TheKiwiCoder3 жыл бұрын
Selecting the gizmo box in the editor might fix it!
@chrislee1774 Жыл бұрын
very late response but for me the alpha value of my colour was default set to 0
@BrandonCoulter2 жыл бұрын
This was crazy good, is there anything this advanced for like a 2d game(Top down or platformer style). Idk if that is even possible, but this was inspiring either way!
@Memes4daysz9 Жыл бұрын
I’m guessing you only really need to do maybe three at most triangles for the left, right and middle or one of you get at it correctly
@warunanirmal95373 жыл бұрын
Excellent tutorial ! but there is a little problem, I'm getting "index out of range error" in console. for(int i=0; i < numVertices; ++i) { triangles[i] = i; }
@TheKiwiCoder3 жыл бұрын
Um, could it be the triangles array is smaller than 'numVertices'?
@FelineRaptor-gv4te2 жыл бұрын
replace ++i with i++
@Meokhongten332 жыл бұрын
@@FelineRaptor-gv4te try that but still not work
@Meokhongten332 жыл бұрын
@@TheKiwiCoder can u tell me how to fix it?
@FelineRaptor-gv4te2 жыл бұрын
@@Meokhongten33 can you share the entire code here? because i need to know what you wrote in the beginning to know why this is happening
@javednoman30512 жыл бұрын
how to make it work in case of enemy is above some ledge
@1armenn2 жыл бұрын
You can make a trigger box at the end of the ledge and then extend the height of the AiSensor, with the OnTriggerEnter callback, and when the AI leaves the trigger box, you can reset it using the OnTriggerExit callback. Idk if this is the best way but something i thought of when reading your comment.
@WelshGuitarDude3 жыл бұрын
Why not make the mesh in blender and mark the vertex indices that you want to move in the mesh data so you know which vertices to move in code if you ever change the angle. Would be far less code to run all the time.
@TheKiwiCoder3 жыл бұрын
Nice idea! I wanted to keep everything in unity for the video 🙂
@FelineRaptor-gv4te2 жыл бұрын
@Mee please no. For people like who don't have a good pc, blender doesn't open or run. so best to do and keep everything in unity
@CrAzYpotpie2 жыл бұрын
@@FelineRaptor-gv4te Blender and Unity go hand in hand, and not to sound mean, but if you can't run blender, then you must be working with the laggiest Unity ever. Might want to upgrade.
@FelineRaptor-gv4te2 жыл бұрын
@@CrAzYpotpie been meaning to. but i work with a small game and scene window so not much lag, and it takes around 5 mins to open a project that over 4 GB. i think its the gpu thats the problem. its a DirectX 10 gpu with only 256 mb vram. processor and ram might also be a problem though as they be 2.6 GHz dual core and 3 GB respectively I have a very old machine from around 2010 with only minor upgrades [almost negligible] over the years. meaning to upgrade it for a while though.
@CrAzYpotpie2 жыл бұрын
@@FelineRaptor-gv4te Hope you can soon! I know what it's like to always be developing on a sub-par system, as well. Never fun, but at least it sounds like your project isn't bogging it down too much yet. Good luck with it!
@starplatinum3305 Жыл бұрын
Doesn't the sensor go through walls ?
@TheKiwiCoder Жыл бұрын
No!! We’ll it shouldn’t. I think it does.
@starplatinum3305 Жыл бұрын
@@TheKiwiCoder what do you mean bruh ?
@TheKiwiCoder Жыл бұрын
@@starplatinum3305 been a while since I made the vid. 10:40 does the occlusion pass
@starplatinum3305 Жыл бұрын
@@TheKiwiCoder oh fck, i see, theres a thing at the end of the sensor that detects too, nice. Btw u have any idea about making a DND thing ?
@starplatinum3305 Жыл бұрын
Sorry for asking too much about that
@basvm61233 жыл бұрын
@itoroenang82663 жыл бұрын
Can you make a battle royale series, or just multiplayer in general pls
@CodingKricket3 жыл бұрын
How do I make the wedge visible in game view?
@TheKiwiCoder3 жыл бұрын
Gizmos are only drawn in the scene view. You’d need to draw a mesh using Graphics.DrawMesh or use the mesh renderer component.
@CodingKricket3 жыл бұрын
@@TheKiwiCoder Thanks! I am making a game with enemy vision and this was really helpful!
@farrukhmalik87473 жыл бұрын
Noice😘👍🤘
@MASTONGAMES3 жыл бұрын
the field of view should not go through walls🤔
@TheKiwiCoder3 жыл бұрын
Yes you're 100% right. In this case though, it's just debug rendering so It doesn't really matter.
@brodiemorris20812 жыл бұрын
It's a bit too fast imo. Maybe try dividing an episode like this into multiple parts so you can actually explain how it works because rn it is way too hard to understand what is happenibg
@FelineRaptor-gv4te2 жыл бұрын
then that better be a separate series because this series has already many episodes
@saulotrujillo81422 жыл бұрын
How can I make the sight of vision to rotate with the AI mesh rotating?