Тёмный

STEALTH ENEMY AI WITH UNITY AND C# - EASY TUTORIAL 

Blackthornprod
Подписаться 545 тыс.
Просмотров 66 тыс.
50% 1

Опубликовано:

 

6 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 101   
@LixianTV
@LixianTV 6 лет назад
You rock Noa! Thank you :)
@braxtonsdev9564
@braxtonsdev9564 6 лет назад
You And Brackeys are the only people out of the hundreds of people I’m subscribed too that I have notifications on for🙂
@Blackthornprod
@Blackthornprod 6 лет назад
Hey Braxton :) ! That means a great deal to me !
@braxtonsdev9564
@braxtonsdev9564 6 лет назад
:)
@christiandavidcoate
@christiandavidcoate 3 года назад
Same here
@blackcitadelstudios
@blackcitadelstudios Год назад
I'm about to make the stealth mechanic for my game. Stealth will be hugely affected by light sources. Thanks for the tips. ❤️🙏☺️
@IAmSuperWeirdGal
@IAmSuperWeirdGal 4 года назад
I just spent too much time trying to figure out why my ray kept returning the player, then I found this video. Thanks Noa! =)
@ipwnzyanoobz
@ipwnzyanoobz 6 лет назад
Is there some way to make the sight of the enemy a cone shaped raycast of some sort?
@TheBcoolGuy
@TheBcoolGuy 5 лет назад
I know you posted this a long time ago, but what I usually do is model the area I want the AI to be searching within in Blender, add it as a separate mesh collider on the main AI GameObject, then use OnTriggerStay() for checking for the player and whatever. You could also just draw/otherwise make a 2D version of such a collider, probably in an art program like Photoshop, or simply editing a polygonal collider 2D.
@BitPlayYT
@BitPlayYT 5 лет назад
@@TheBcoolGuy thing is, then if the player is behind a wall and the cone is bigger than the wall, the enemy would detect the player
@Max2000skill347
@Max2000skill347 4 года назад
@@BitPlayYT Ik this is an old comment, but you can detect it with the way provided above, and then use Raycast to check if the sight is actually clear. Cheers.
@altemailaltemail9851
@altemailaltemail9851 4 года назад
Get the angle between the two vectors, the enemy's head and players head, check if it's less than a specified angle, such as 50, then raycast from the enemy's head to the players head, if it hits the players head you know hes been spotted, and then you can do the spotted action lol.
@ludicrouS_406
@ludicrouS_406 4 года назад
You can try using a trigger collider
@manandua_28
@manandua_28 3 года назад
I can't see the line , even after not adding the collider to enemy . so please tell how to solve it , because i am a beginner and don't know a lot about it
@williamstrnad4243
@williamstrnad4243 6 лет назад
This dude has art skills
@steveag8018
@steveag8018 5 лет назад
I do have to admit that your tutorials are really awesome, helped me a lot in my project. Thanks for making these awesome videos and hope you can make further more videos.
@Linkedin-mj2qe
@Linkedin-mj2qe 3 года назад
I understand that this video is old but I found it just when I needed it
@TETE
@TETE 3 года назад
do you know how to make that only line rotates?
@amitpatange311
@amitpatange311 6 лет назад
Please make more tutorials in AI series, you are killing it. I am so excited.
@beansheeran7322
@beansheeran7322 3 года назад
Tip: if you see no line make sure that the enemys collider is toggled off
@VanVuurenStudios0310
@VanVuurenStudios0310 4 года назад
Thanks, Black Thorn. Now I know what to do if I want to make a Batman Arkham sort of thing.
@DefaceGames
@DefaceGames 6 лет назад
Can u pls make one tutorial on Enemy AI Field of View
@hassonhamo4118
@hassonhamo4118 6 лет назад
Thank you Noa you are the best , easy and short , direct to the point
@ronangoodman2066
@ronangoodman2066 5 лет назад
i dont get my line to make circles i just stands still and when in the system it hit something it teleports to the location of the player and stops and does not conitiue
@hanniballecter1954
@hanniballecter1954 2 года назад
Thanks for all your great content, you are a real life saver!
@alvin2674
@alvin2674 3 года назад
Is there a 3D version of this tutorial???
@thomasjensen9581
@thomasjensen9581 6 лет назад
i must say that your ai tutorials are really good!
@noobiotstorymodetamil
@noobiotstorymodetamil 5 лет назад
Hey blackthornprod! i really love ur videos but unfortunately this time i cant see proper results in the AI. I am actually starting to learn the basics of AI. And please help me i will give u the enemy code: using System.Collections; using System.Collections.Generic; using UnityEngine; public class Enemy : MonoBehaviour { public float roatationSpeed; public float distance; void Start() { Physics2D.queriesStartInColliders = false; } // Update is called once per frame void Update () { transform.Rotate(Vector3.forward * roatationSpeed * Time.deltaTime); RaycastHit2D hitInfo = Physics2D.Raycast(transform.position, transform.right, distance); if (hitInfo.collider != null) { Debug.DrawLine (transform.position, hitInfo.point, Color.red); } else { Debug.DrawLine(transform.position, transform.position + transform.right * distance, Color.green); } } } I cant get the ray color on Unity please help me :(
@kbrokarl1903
@kbrokarl1903 4 года назад
Can you make more AI. Your tutorials are all the best.
@BeerfootBandit
@BeerfootBandit 4 года назад
I cant support on patreon atm but I'll watch the ads
@markoboredguy6911
@markoboredguy6911 4 года назад
How do I do this in 3D. Its a great tutorial but im having difficulties detecting collisions in 3D.
@reduser77
@reduser77 6 лет назад
could you please make a video about that explosion animation that happened to the player when he hit by the raycast .
@marioc647
@marioc647 2 года назад
how did u do the death animation? I know it has been almost 4 years but plz help
@kotasimov460
@kotasimov460 4 года назад
pls help how to rotate raycast, i mean in angle for example: RaycastHit2D hitInfo = Physics2D.Raycast(transform.position, ("here insert angle"), viewDistance);
@chinyonglim7624
@chinyonglim7624 6 лет назад
Great video again~! Thank so much~ Noa~! I have one question about previous videos about character moving, 1. Beside using navigation agent, there are people using addforce/ moveposition/ velocity to move an player/objects, how do we decide to apply any of these methods to our player/objects? Also, I had followed your 3d AI Click-to-move navigation tutorial, and I am able to do simple interaction between player and objects, such as chat dialog, destroy objects. However, how should I imply slightly advanced interaction, such as sitting on/leaving a chair, or lift an objects and carry around.
@Blackthornprod
@Blackthornprod 6 лет назад
Hey and thanks :) ! For more complex interactions simply use various functions. For example if you get near a chair you may need to press SPACE and your character will do a sitting animation (the chair could have a script that handles that). As for nav mesh agent, it can't really be replaced by addForce/movePosition... since it's a great method for pathfinding, in other words reaching a destination the fastest way possible while dodging obstacles :) ! Hope this helps ! Stay tuned and thanks again for the support !
@simoncodrington
@simoncodrington 6 лет назад
Another good video man, top notch 👌
@rkpixeldesign
@rkpixeldesign 5 лет назад
Hey bro can you also do Field of view tutorial . btw thanks for this info
@lytondeanpomarethyme5605
@lytondeanpomarethyme5605 6 лет назад
How can i make this work in a 3D game?
@AliverTwisted
@AliverTwisted 6 лет назад
Great video! appreciate it. thank you
@d2b906
@d2b906 2 года назад
Is there an easy way to make the line of sight larger like 70 degrees instead of a line
@GianniRivero
@GianniRivero 6 лет назад
Another amazing video!
@cypcraft9171
@cypcraft9171 3 года назад
Can you make tutorial about enemy's Field of view 2d for turret ai for top down game?
@pulkitbhardwaj9928
@pulkitbhardwaj9928 3 года назад
3:11 that's creepy and funny at the same time
@zecaxy5650
@zecaxy5650 6 лет назад
What would be the best way to do collision? As kinematic doesn't allow collisions easily
@ir3dy976
@ir3dy976 6 лет назад
We can give the raycast a distance correct? Can we also add multiple rays for different angels??
@Rook1e0ne
@Rook1e0ne 6 лет назад
Easy tutorial With useful reasults
@Joruzhia
@Joruzhia 5 лет назад
I'd like to make it so that when enemy's raycast hits player it triggers my follow player script and when player is dead it returns to it's previous behaviour.... But i have no idea how to do this.
@chrisdanikas7918
@chrisdanikas7918 6 лет назад
nice man, you are really good
@anubisdunk
@anubisdunk 6 лет назад
Awesome. As always.
@bazingazeroni
@bazingazeroni 4 года назад
thank you brother
@happymoments5016
@happymoments5016 6 лет назад
Thanks you!
@priyadaksheshpatel8384
@priyadaksheshpatel8384 4 года назад
Can you help me so that the Line of sight is wider than the line you made Plz help but still a really good tutorial, keep making these things(from 2020)
@Qwaizor
@Qwaizor 4 года назад
I don't even see the line for some odd reason
@priyadaksheshpatel8384
@priyadaksheshpatel8384 4 года назад
Make be it’s a problem in the line renderer or on the script and don’t forget to write the order on the line script as him
@priyadaksheshpatel8384
@priyadaksheshpatel8384 4 года назад
Tell me if it works plz
@Qwaizor
@Qwaizor 4 года назад
@@priyadaksheshpatel8384 can you send me your code I already tried these methods looks like nothing seems to be working so can u just send it?
@priyadaksheshpatel8384
@priyadaksheshpatel8384 4 года назад
Ok sure I will send it in a few days because I am also working on a different project and I will send it when I have time. Is that ok?
@dbarba22
@dbarba22 6 лет назад
hello great videos, I'm making the enemy without rotating is there a way to change the offset of the Ray to be at the enemies eyes?
@vivi-gl3vk
@vivi-gl3vk 4 года назад
make a child object and position it to where you want, and put all the ray stuff on it
@MoJw98
@MoJw98 3 года назад
Some one loves you and he from in Iraq❤❤❤❤❤
@bto6721
@bto6721 6 лет назад
First? :D Great video!
@Blackthornprod
@Blackthornprod 6 лет назад
Thanks Oren :) !
@sheroqueer5651
@sheroqueer5651 6 лет назад
Great video :D But when i try to do the same in 3D, the line 19, i change RaycastHit2D for RaycastHit and Physics2D for Physics, i have an error : "cannot implicity convert type 'bool' to 'UnityEngine.RaycastHit' " :(
@NG-ri9fy
@NG-ri9fy 5 лет назад
Le monde de Léah MacBunny Yeah, it changes from 2d to 3D. If anyone’s having trouble with this, change the line from “RaycastHit2D hitInfo = blah blah” to “ “RaycastHit hitInfo; if(Physics.Raycast(transform.position, transform.right, out hitInfo, distance)) { //rest of code }”
@sunilpal2860
@sunilpal2860 4 года назад
M new to unity ,I really like your vdo Noa, really appreciate it, just could u let me know where can I find d code of blue (player) movement,please reply it will b greatfull
@kdev3235
@kdev3235 4 года назад
He has uploaded a video for it
@sunilpal2860
@sunilpal2860 4 года назад
@@kdev3235 link please,it would b great
@shlokmotwani
@shlokmotwani 5 лет назад
If I write 'Vector3.right' instead of 'transform.right' in the below line, it does not detect the object collisions. Can you please tell me what is the reason behind that? RaycastHit2D hitInfo = Physics2D.Raycast(transform.position, transform.right, distance);
@cq4330
@cq4330 5 лет назад
have you set collision colliders on everything else?
@DawnosaurDev
@DawnosaurDev 6 лет назад
My raycast always returns null?
@nicorueda5809
@nicorueda5809 3 года назад
If somebody cant see the line and the code is OK, unable collider of the enemy :)
@manandua_28
@manandua_28 3 года назад
I haven't added any collider to the enemy but still the line is not visible . so can you please tell the solution for it
@ahmedthegreat3973
@ahmedthegreat3973 4 года назад
Does It Work On 3D Game?
@setseretze3565
@setseretze3565 4 года назад
hmm yes i see no line Edit: it has a collider =\
@IAmSuperWeirdGal
@IAmSuperWeirdGal 4 года назад
Same here. XD
@benjaminsnow5095
@benjaminsnow5095 4 года назад
Freaking epic!
@tyronedizon2980
@tyronedizon2980 6 лет назад
How can u make the code for 3d objects?
@worldlampandfriends1211
@worldlampandfriends1211 6 лет назад
yes
@tunit6458
@tunit6458 4 года назад
1:17 - Name game please???
@markvincentdimailig1137
@markvincentdimailig1137 5 лет назад
Invitation Invalid for the discord :
@oltepmutant2722
@oltepmutant2722 6 лет назад
Im new here:D
@Blackthornprod
@Blackthornprod 6 лет назад
Then welcome to the family :) !
@oltepmutant2722
@oltepmutant2722 6 лет назад
:D
@RevenaSurniak
@RevenaSurniak 6 лет назад
Can you make it a 3d version -.-
@DamanD
@DamanD 6 лет назад
its almost the same with 3d..
@worldlampandfriends1211
@worldlampandfriends1211 6 лет назад
how?
@RevenaSurniak
@RevenaSurniak 6 лет назад
2 months later I think this is true.
@RevenaSurniak
@RevenaSurniak 6 лет назад
www.helloneighborgame.com
@Darksassy
@Darksassy 5 лет назад
Is his Discord server dead?
@samv93
@samv93 5 лет назад
I would rlly recommend joining the server, and its deffo not dead
@ReyBanYAHUAH
@ReyBanYAHUAH 3 года назад
Always remember to repent of your sins (sin is transgression of YAHUAH’S LAW: Genesis, Exodus, Leviticus, Numbers, & Deuteronomy) And Have Belief On YAHUSHA HAMASHYACH. HE Died and Rose Again On The Third Day So that you can be forgiven of your sins! HE Loves you! Come to HIM!🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂🙂
@voidling2632
@voidling2632 5 лет назад
video is fake, does not work. And how could it, distance is always zero.
@squishybluecat
@squishybluecat 4 года назад
lol why would the video be fake? it works fine for me...
@mrarne2749
@mrarne2749 4 года назад
@@squishybluecat for me too but it could be his rigidbody that is making problems
@sentinelmusic107
@sentinelmusic107 4 года назад
You set the distance in the Inspector.
Далее
How to code SMARTER A.I. enemies | Unity Tutorial
32:49
I Paid Fiverr Game Developers to Make the Same Game
10:25
Creating SMART enemies from scratch! | Devlog
5:40
Просмотров 319 тыс.
Enemy Patrolling Unity Tutorial
8:28
Просмотров 9 тыс.
We made Vampire Survivors BUT in 10 Lines of Code
7:08
3 Hours vs. 3 Years of Blender
17:44
Просмотров 4,8 млн
FULL 3D ENEMY AI in 6 MINUTES! || Unity Tutorial
5:52
Просмотров 629 тыс.