This is exactly what i want for a long time.... quick and usefull tutorials.. i've seen this in 24 minutes and even 45 minutes to explain this :) thank you
@AlexanderZotov6 жыл бұрын
Happy to help. Thanks for your feedback!
@Searwitch2 жыл бұрын
Others would've milked this for 10-20 minutes. Thank you very much!
@random_precision_software6 жыл бұрын
I love these quick and lots of tutorials, it's about time someone done a video everyday, and the content is what everybody wants. 👌😀👍
@Worlnof2 жыл бұрын
I really do LOVE you! You are my hero, I had to search soooo long to find someone explaining this to me
@bren.n.z. Жыл бұрын
I have been searching for a tutorial like this for days and this is exactly I need. Awesome video
@01dragonix4 жыл бұрын
in case that is not working for you check that the Z position is the same on the Enemy and the Point
@leonholli72813 жыл бұрын
Saved my day
@anonymy8343 жыл бұрын
thank you! you saved my day! had been confused for ages why my sprite did not work. It came to my mind that someone in the comment area could comment on this. So I reviewed the comments one by one. You saved my day!
@7amdanae8983 жыл бұрын
To add rotation if you use car as a gameobject: if (waypointIndex != waypoints.Length) { Vector3 targetInVec3 = new Vector3(waypoints[waypointIndex].transform.position.x, waypoints[waypointIndex].transform.position.y, 0f); Vector3 direction2 = targetInVec3 - transform.position; float angle = Mathf.Atan2(direction2.y, direction2.x) * Mathf.Rad2Deg - 90; Quaternion rotation = Quaternion.AngleAxis(angle, Vector3.forward); transform.rotation = rotation; transform.position = Vector3.MoveTowards(transform.position, waypoints[waypointIndex].transform.position, movespeed * Time.deltaTime);
@astrolabtechnologies2 жыл бұрын
thanks :)
@racmanov3 жыл бұрын
works like a charm. had to work around some stuff coz i do 3d and use rigidbodies. But now it works flawlessly. ty
@michalstanislawbun54436 жыл бұрын
everyday a new and useful lesson! thanks a lot
@rjsiii34 жыл бұрын
One of those videos that takes something that seemed impossibly confusing and makes it feel like "duh well of course". Great job and i appreciate the shortness of the video, as much as the games of the idea. Liked and subscribed
@ilovecode37272 жыл бұрын
so fast and clear. THX!!
@phpickles4 жыл бұрын
Ty!!! (if is not working for you make sure your z coordinates on every waypoint is set to 0).
@beaverjoe91716 жыл бұрын
So Effective and convenient way for me! THANKS!
@lazzzzz_exe2 жыл бұрын
UnassignedReferenceException: The variable waypoints of FollowThePath has not been assigned. You probably need to assign the waypoints variable of the FollowThePath script in the inspector. help pls!!
@Parisphotogram963 жыл бұрын
thanks bro , i love what you sharing with us
@AlexanderZotov3 жыл бұрын
Happy to help
@MichaelRyanNewellКүн бұрын
That’s how they do Sonic. You enter the loop, it enters a path, and you exit the loop.
@liudaxun3 жыл бұрын
Any idea why there's an error Index was outside the bounds of the array? when I tried running
@apoleyta97604 жыл бұрын
I don't know why but ıt doesn't work for my game. I have done whatever you said. But my enemy doesn't walk. Just pop ups in the first point because of the codeline in the Start method
@geeayarrwhy3 жыл бұрын
Did you find out why? I'm having the same issue. :/
@AlexanderZotov3 жыл бұрын
Check out Z axis value. It should be zero.
@griseldapozo14053 жыл бұрын
@@geeayarrwhy I had the same issue, had all my Z's on 0, but I had my waypoints in a container and that had the Z on a different value, changed that and works now.
@vakarisgasiunas18673 жыл бұрын
Hello, new to unity, is the any way to make it, that the enemy would start over after reaching the last checkpoint (for example: Waypoint 1 -> Waypoint 2 -> Waypoint 3 -> Waypoint 1 -> Waypoint 2 -> Waypoint 3...
@AlexanderZotov3 жыл бұрын
I have video on that
@vakarisgasiunas18673 жыл бұрын
@@AlexanderZotov would you be so kind to link it please?
@AlexanderZotov3 жыл бұрын
@@vakarisgasiunas1867 Here kzbin.info/www/bejne/e6m1gnR7opmdhsk
@snowm561 Жыл бұрын
I only have one waypoint, because the enemy is simply walking straight across the screen. How do I make it so that they aren't instantly going to the waypoint but instead more slowly going to it?
@itsdonix Жыл бұрын
how can i make it loop the movement path?
@marvicbautista45833 жыл бұрын
Hi again, when i make my enemy as a prefab a cant put the way points on the inspector i dont know what happen.
@Mamaco915 Жыл бұрын
Nice tutorial but for some reason the square doesnt move what is the problem ?
@SMGtk3 жыл бұрын
what if there are two options at a point? How will the object make the decision randomly
@mobilemon50325 жыл бұрын
The object is moving for me but it moves really slow. I followed the tutorial exactly, what's wrong?
@blackstarstudios9203 жыл бұрын
Its not letting me add my waypoints into the slot. Help!
@jamesesa5014 жыл бұрын
why my Enemy is not moving anymore when I change the enemy to another place?
@gavinckw975 жыл бұрын
Hello there! May i know how do i make the object to rotate based on the path?
@IROC___Jeff4 жыл бұрын
This only worked once for me. I remade my enemy and followed the video again and my new enemy just starts at the first waypoint and just sits there. No movement regardless the speed i set. The script was copied and pasted so there are no errors from my end. Any ideas?
@AlexanderZotov4 жыл бұрын
Check Z coordinate. It should be zero.
@cristianquiroz42004 жыл бұрын
For some reason the comparison between Vector3 fails. try this: private float distancia; private void Move() { if (waypointIndex
@howtogamedev_3 жыл бұрын
it was really helpful, thank you so much
@marvicbautista45833 жыл бұрын
my sprite only goes to the first point and don't go to the next one I don't know whats the problem. I hope I can find some ways to fix this. Thankyou
@marvicbautista45833 жыл бұрын
I Changed the z to zero and it works, My error is my path is parented to an object which is positioned to -3 Thankyou!!
@janyiren8463 Жыл бұрын
@@marvicbautista4583 could you explain it to me please? Did you change smth in the code? Because every object is placed on z 0 but still not working(((
@anonymy8343 жыл бұрын
hi I edited the c# script and dragged it to the avatar. it gave me an error of NullReferenceException: Object reference not set to an instance of an object. Do you know what caused this error?
@songediter91013 жыл бұрын
can you please help? i want my enemy to face the point when he follows it
@gamerel502811 ай бұрын
Thank you so much
@RatoCavernaBR6 жыл бұрын
There is any way to do it using bezier?
@XenosDGamer9 ай бұрын
Please make a video about how the enemy will change it's rotation according to the direction it's moving in
@Ghoqable6 жыл бұрын
in Unity 2d can you make a tutorial where a character moves randomly but doesn't go through certain objects like walls? Without navmesh?
@sife-i9n3 жыл бұрын
it's just follow one waypoint than stops
@Chief-wx1fj6 жыл бұрын
Enemy tutorials make me happy
@lordtoby74545 жыл бұрын
This helped me very much A quick question: I want to make an enemy repeat the path he follows over and over. Do I just wrap the code into a loop?
@petipois284 жыл бұрын
If (waypoint == waypoint. Length - 1) Waypoint index = 0 This way it will start over again
@g1apefruit4 жыл бұрын
@@petipois28 Where do i put this in the code
@petipois284 жыл бұрын
@@g1apefruit 1:03 inside the move function after the first if() statement
@beaverjoe91716 жыл бұрын
Long time not see you man~~~~
@AlexanderZotov6 жыл бұрын
Been on vacation. Back again ;-)
@beaverjoe91716 жыл бұрын
sounds good ! you must very enjoyable travling. Looking forward your tutorials if you have enough time~
@ThatLazyGameDev2 жыл бұрын
Nice Tutorial, but how can I make it loop? Like go back to point 1 and just repeat
@beaverjoe91716 жыл бұрын
!!!!!My pleasure! Hopes I can learn more from you!
@AlexanderZotov6 жыл бұрын
I do my best for that :-)
@random_precision_software4 жыл бұрын
Can you Change this so the player draws as line then an object follows along that line?
@dragontailsb19712 жыл бұрын
if it isn't working for you, change "transform.position = Vector2.MoveTowards..." to "transform.position = Vector3.MoveTowards..."
@sumkid9263 Жыл бұрын
clutch, this is the only thing that worked
@Madheim777 Жыл бұрын
IT WORKED! thank you!!
@karislewis51925 ай бұрын
Thank you so much. Couldn’t figure out why z axis was changing even tho it was set to zero 😭
@dimitrishow_D3 жыл бұрын
I tried this and tried to spawn a new enemy after it dies.. But the enemy prefab then doesnt have the waypoints anymore.. I tried adding the wavepoints to the prefab in prefab folder but that doesnt work i can only add them when is in hiërarchie.. Do you know how i can solve this... Have a enemy have waypoints and being able to spawn it?
@suryakumara33604 жыл бұрын
Dear Alexander, how to make the dynosaur go back to the first waypoint ? Hope for your reply thanks
@AlexanderZotov4 жыл бұрын
Here is the answer kzbin.info/www/bejne/e6m1gnR7opmdhsk
@ambarmajumdar49336 жыл бұрын
Sir when I try to make this enemy as a prefabs the the element in way points are not there why that happened
@JongHyunSM4 жыл бұрын
can you explain how to face idle with 8 directions after follow the path?
@siscoye94546 жыл бұрын
Had it working once or twice, went back to use the script, and again it wont pass waypoint one , no errors :(:(:(
@davidlandenkarlsson99835 жыл бұрын
@SuperNinja Had the same issue as the guy above. Tried putting the if statement above the other but it yielded the same result. Thing is that it works fin for one of my enemies, but if I change waypoint (as is the case for my second enemy) it just stops working. Both enemies and paths are put up the same way, but one enemy works, not the other.
@unbounceexpert5487 Жыл бұрын
How to make waypoint in loop ?
@prevratnik6 жыл бұрын
It's shortest and greatest tut
@Bes2TheFort6 жыл бұрын
What do I change, if I want it to continue without stopping?
@ZackRing6 жыл бұрын
Its in another one of his videos. kzbin.info/www/bejne/e6m1gnR7opmdhsk
@gabrielalbu91346 жыл бұрын
will this work for 3d if i change vector2 to vector 3
@jonsmith28324 жыл бұрын
I know this is late but, yes it does.
@Osoclever8 ай бұрын
Thank you
@alexandertuzovskiy4856 жыл бұрын
Thank you very much! Very good and usefull :) I have one question. You have a very interesting tutorial with dice. And I'm tring to use it. For example, you drop the dice, got a number, and how to make your character go that number waypoints?
@siscoye94546 жыл бұрын
Some reason mine never goes past waypoint one Followed the tut to a TEEE , no errors in code, waypoints in inspector set up :(
@siscoye94546 жыл бұрын
didnt put capital W on waypoints object :( spent 5 hours doing it over n over lol
@sharif476 жыл бұрын
I need some help with adding some features to this. 1. I'm working on a 3D environment and I want the y-axis value to be determined by gravity. 2. I'm working on a car AI. So, whenever it faces a turn, it should at least rotate in order to make the turning look believable. Because the path is created by finding the shortest path based on a grid system, the adjacent points are the center of two adjacent squares in the grid. So, the distance between two adjacent points are either 1(for horizontal/vertical) or √2 (for diagonal). See if this info can help in making easier code for rotating.
@turoreal4 жыл бұрын
Hi! thank you, i combined it with a scriptable object in order to make it portable and more flexible.
@danielfernandobaquerorojas21414 жыл бұрын
ThankYou!
@AlexanderZotov4 жыл бұрын
Happy to help
@miguelmonreal.88744 жыл бұрын
This is great. Can you show how you would set this up for 2 different paths and have it randomly choose which path to take?
@suryanshrana8383 жыл бұрын
you could give it two lists and make randomly choose which list of waypoints its going to follow
@monika-nowakowska6 жыл бұрын
Thanks! I love your lessons - short form is really cool! If you'll have some time, can you do tutorial about player bouncing from the wall (tower platformer)? You can check out example of what I have in mind in Icy Tower. Thank you in advance!
@8978martin6 жыл бұрын
good tutorial
@erinhaingagatun70624 жыл бұрын
Добрый день, а как сделать что бы наш Enemy рандом выбирал путь, когда их больше одного?
@abdurrehmankhan16996 жыл бұрын
How to add pong effect in this script
@gamoe2 жыл бұрын
thanks you
@aonmuhammad43056 жыл бұрын
thanx!!!!
@kyleplair49292 жыл бұрын
Could someone paste the script?
@mulagraphics6 жыл бұрын
Please make a video on how to give other players - Coin, Items, Weapons
@bashirmanafikhi6 жыл бұрын
THAAANK YOOU
@personnotfound50074 жыл бұрын
I can't figure out how add the script to the enemy, could someone help?
@nmb864 жыл бұрын
Hello :) click on the enemy in the scene window, then under inspector you will see all the components. now, just find your script file in the project directory and drag it to the inspector :)
@KoolakStudio6 жыл бұрын
really thanks man really thanks . how one object can play different sound with one audio source
@AlexanderZotov6 жыл бұрын
I have such tutorial already. Please check it out kzbin.info/www/bejne/bqGpnaGvm7eZiMU
@dharmeshkumar27636 жыл бұрын
Waoo nice method
@wearwolf42023 жыл бұрын
Maybe if you did a code tutorial for this maybe
@AlexanderZotov3 жыл бұрын
What?
@skywoker1234566 жыл бұрын
Очень хорошие у тебя уроки, сделай пожалуйста видео, как делать автосохранение и загрузку в игре.
@cristianquiroz42004 жыл бұрын
For some reason the comparison between Vector3 fails. try this: private float distancia; private void Move() { if (waypointIndex