This is great, good work man, With my game i am making lots of houses and stuff so i want the ai to be able to naviagate through these houses to get to the player and stuff including going up stairs. So is there a way to make the ai do this using this kinda method or is there a better way? Thanks in advance (:
@steamisM50 all your videos are confusing, or are they not in an order? What is the one you mean? If i use the raycast one wount it turn away when the player goes up stairs? (:
@JasonDolan2169 What is the file extension on the file, because if you are writing in CS, it has to have a class, if the file extension is .js then the error should be happening, but if it is .cs, then copy the contents of the file into a .js file...
I am gonna repeat the question someone asked bec' u didn't answer it. Is there any way to make this multiway points system with prefabs?
I use Instantiate function to create object during runtime with prefabs. But I couldn't figure out how to make multiway points system with those. Please this time answer it :) thanks a lot.
@TheTasotMr Do you mean actually instantiate the waypoints, or the AI? If you mean AI, you will have to record the waypoints and assign it to the AI right on spawn. If you are instantiating Waypoints, you will, by code, need to add the waypoints to an AI. If you are instantiating both, make sure you do the Waypoints first.
I am not exactly sure what you are asking.
Also, I don't get notifications about comments, so I answer whenever I may see some.
onely problem i have is my capsule keeps sumersalting towards the waypoints. i added rigedbody with "use gravety" on.... when i turn "use gravety" off it moved normal. but you have it on
Is there any possible way you can make a prefab of this ?
I'm having a slight problem. I got it to work with just the one waypoint. but now it doesn't move when i try added a second. It just slowly falls due to the rigidbody.
i was playing with the script you made, if you could instantiate a waypoint prefab at the initial position in Awake() and assign the last element of waypoint to this, he does return to the initial position.
this is exactly wat you already do by creating a waypoint at his initial position, but the script does this so we don't have to care about it, and well exactly serves the purpose.
someone must have already done this, but i got too excited, and well. :)
i was playing with the script you made, if you could instantiate a waypoint prefab at the initial position in Awake() and assign the last element of waypoint to this, he does return to the initial position.
this is exactly wat you already do by creating a waypoint at his initial position, but the script does this so we don't have to care about it, and well exactly serves the purpose.
someone must have already done this, but i got too excited, and well. :)
@dranoel1963 that is the point of the loop. A loop resets.
If you want a ping-pong (where it goes back through the whole path back to the start) you will have to have to do a whole lot more than I am willing or able to write in a comment, but essentially, just do the reverse behaviour, and have a check to see if you are going backwards or forwards for the type of movement to use.
@steamisM50 ok i got it but how to i make it rotate smoothly to the waypoint? it gives me errors when i try to make it like transform.rotation(waypoint, target.rotation) or something like that, im kinda tired right now i dont wana think..
@Pottsy98 Ummm, currently no, but I may go over it this weekend.
Though I do recommend going through the Advanced AI series, as they are a whole lot more advanced, and a whole lot more useful. Though if you need the Multi-waypoint specifically, I will record one this weekend, maybe. Depends on how busy I am.
K, now I made another waypoint, but once the enemy reaches the waypoint, he has a seizure and doesnt go to the other point. My waypoints are empty game objects, would that mess it up?
@Dnoop4life No, it wouldn't. He may not be getting close enough to the waypoint. try bumping up the distance you have to be away from the waypoint a bit and it will work. The higher the value, the smoother the curve. I'd go with like... 0.5f to 3f, based on how smooth you want it to be.
@Slim08PU If the enemy is too tall, and thus, the center is too far away from the waypoint, then it won't switch, so, try increasing the value (instead of 1, try 5)
in the code to switch Waypoints, put in Debug.Log("I have switched"); and see if that is ever fired, if so, it is switching it, it just can't move to it, or you are assigning a null, if not, then maybe you are doing your distance check between current waypoint and enemy wrong, and you may want to check that out.
Maybe you can help me: i have 5 waypoints + 5 buttons and want to let the enemy go to waypointX, if the user klicks buttonX. Tried to create a function Goto(X), but that doesnt work. Could you give a hint?
@beliebigerusername On the press of a button, run a function that sets the target to the waypoint, and with how I set up the movement code in this, as long as the AI isn't at the waypoint, he will go to it, so you just use that movement code. I hope this helps!
dude this would really help out your videos if you helps us more i dont know you even got the waypoints and plus i had to pause your video make a script then copy it all down and save the same name as your script witch is really hard to see btw... but other thatn that i like your videos
@r3ist3 The waypoints were from the first part of the tutorial, the 1 waypoint system, I had created the waypoints, in this one, if there was any difference in waypoints, it was just copying some more out. As for the scripts, if they are in Javascript, they don't need to be the same name, if in C#, they have to be same as classname. There is no need to make it the same as mine. Also, I DO say what I am typing (mostly) so you should be able to follow along.
You have to make it, it is the script we make here, but it isn't "AutoWayPoint" try rewatching... if you are following along, you should of created it already
@girlinthegarden So, I just reread your question, and if you are trying to do the tutorials from Unity Website, don't ask me for help for those, because I have never done them. If you were asking for help with my scripts, I hope I helped :)
Hey I tried doing this tutorial for a basic game i'm making but it doesn't appear to be working for me. What version of Unity do you have? (not sure if that would make the difference or not)
I'm making a 3d sidescroller and when i implement this script it changes the starting location of my camera and freezes everything. no errors come up
Not sure why it would do this. you may want to check your settings for your other things, and you may want to make sure you aren't trying to control the character AND do waypoint stuff at same time.
I was using 2.5 in this tutorial I believe, but that shouldn't make a difference.
Hello. Great tutorials!!! Btw. if you remove waypoint[0] = transform; from Awake() functions, all work fine - no need 3 waypoint etc. Sorry for bad english :)
Comment removed
Warrtorg 3 weeks ago
Comment removed
Warrtorg 3 weeks ago
just so people know, if you want the enemy to look at the waypoint, add
transform.LookAt(waypoint[currentWayPoint]);
directly below
velocity = moveDirection.normalized * speed;
vailmaster5 2 months ago 2
can you get him to wait at each waypoint for a few seconds?
vailmaster5 2 months ago in playlist More videos from steamisM50
This is great, good work man, With my game i am making lots of houses and stuff so i want the ai to be able to naviagate through these houses to get to the player and stuff including going up stairs. So is there a way to make the ai do this using this kinda method or is there a better way? Thanks in advance (:
XDGabzXD 3 months ago
@XDGabzXD If you go check out my A* tutorials, they cover the exact behaviour that you are asking about.
steamisM50 3 months ago
@steamisM50 all your videos are confusing, or are they not in an order? What is the one you mean? If i use the raycast one wount it turn away when the player goes up stairs? (:
XDGabzXD 3 months ago
thanks i love the tutorials :D subbed :)
theslayer29179 5 months ago
Im doing everything exactly as in the video and I keep getting this error:
"Cant add script behaviour OneWaypoint. The scripts file name does not match the name of the class defined in the script."
What am I doing wrong? Can someone help plz!!!! Thank you.
JasonDolan2169 5 months ago
@JasonDolan2169 Check to make sure the class is the same name as the file. It won't work otherwise.
steamisM50 5 months ago
@steamisM50 Ok forgive me for asking but where/what is the class?
JasonDolan2169 5 months ago
@JasonDolan2169 What is the file extension on the file, because if you are writing in CS, it has to have a class, if the file extension is .js then the error should be happening, but if it is .cs, then copy the contents of the file into a .js file...
steamisM50 5 months ago
@steamisM50 The file extension is .js
So that isnt the problem. Im not sure but the problem might be this message that comes up every time I save a script: It says,
"Moving file failed
Moving
Temp/f250bb76f0c84b84fa663eb4e2b7d666.dll to
Library/ScriptAssemblies/Assembly-UnityScript.dll
Failed: Access is denied."
Do you have any clue what that means??
Its very annoying, it pops up all the time...
JasonDolan2169 5 months ago
This has been flagged as spam show
@steamisM50 Forgive me for asking but where/what is the class name?
JasonDolan2169 5 months ago
I am gonna repeat the question someone asked bec' u didn't answer it. Is there any way to make this multiway points system with prefabs?
I use Instantiate function to create object during runtime with prefabs. But I couldn't figure out how to make multiway points system with those. Please this time answer it :) thanks a lot.
TheTasotMr 6 months ago
@TheTasotMr Do you mean actually instantiate the waypoints, or the AI? If you mean AI, you will have to record the waypoints and assign it to the AI right on spawn. If you are instantiating Waypoints, you will, by code, need to add the waypoints to an AI. If you are instantiating both, make sure you do the Waypoints first.
I am not exactly sure what you are asking.
Also, I don't get notifications about comments, so I answer whenever I may see some.
steamisM50 6 months ago
you're awesome, your tuts helps me a lot...
cantaloupeRed 7 months ago
Very good tutorial. Helped me out a lot.
TheAxedPowers 11 months ago
thanks man this was great.
TripodGRANNE 11 months ago
I'm doing exactly what you did but the enemy is stuck with only 1 waypoint. Can't go to the other waypoint any help please? thanks
spanni87 11 months ago
great tutorial super helpful.
onely problem i have is my capsule keeps sumersalting towards the waypoints. i added rigedbody with "use gravety" on.... when i turn "use gravety" off it moved normal. but you have it on
westwolf22 1 year ago
your tutorials are my first ai tutorials and they are good so far so thanks
198boblob 1 year ago
@steamisM50
Lol never mind fixed my problem.
Thanks for the awesome tutorial. : )
Belowtheshoe 1 year ago
@steamisM50
Is there any possible way you can make a prefab of this ?
I'm having a slight problem. I got it to work with just the one waypoint. but now it doesn't move when i try added a second. It just slowly falls due to the rigidbody.
Belowtheshoe 1 year ago
This has been flagged as spam show
i was playing with the script you made, if you could instantiate a waypoint prefab at the initial position in Awake() and assign the last element of waypoint to this, he does return to the initial position.
this is exactly wat you already do by creating a waypoint at his initial position, but the script does this so we don't have to care about it, and well exactly serves the purpose.
someone must have already done this, but i got too excited, and well. :)
yashvardhanable 1 year ago
i was playing with the script you made, if you could instantiate a waypoint prefab at the initial position in Awake() and assign the last element of waypoint to this, he does return to the initial position.
this is exactly wat you already do by creating a waypoint at his initial position, but the script does this so we don't have to care about it, and well exactly serves the purpose.
someone must have already done this, but i got too excited, and well. :)
yashvardhanable 1 year ago
i cant make it loop, it just goes to the 1st one
dranoel1963 1 year ago
@dranoel1963 that is the point of the loop. A loop resets.
If you want a ping-pong (where it goes back through the whole path back to the start) you will have to have to do a whole lot more than I am willing or able to write in a comment, but essentially, just do the reverse behaviour, and have a check to see if you are going backwards or forwards for the type of movement to use.
steamisM50 1 year ago
@steamisM50 ok i got it but how to i make it rotate smoothly to the waypoint? it gives me errors when i try to make it like transform.rotation(waypoint, target.rotation) or something like that, im kinda tired right now i dont wana think..
dranoel1963 1 year ago
@dranoel1963 rotation isn't a function, it is a property....
What you want to do, is transform.rotation = Quaternion.Slerp();
Fill in the parameters for Slerp on your own.
And I am sorry you are tired, but you have to think about this, otherwise you won't get very far on your own...
steamisM50 1 year ago
Comment removed
dranoel1963 1 year ago
Comment removed
dranoel1963 1 year ago
This has been flagged as spam show
@steamisM50 i get this: rotation' is not a member of 'UnityEngine.Transform[]'.
i think it shoud be waypoint[] or something but i cant figure it out
dranoel1963 1 year ago
@steamisM50 ok ok i got it, i used waypoint[currentWaypoint].rotation
thanks for opening my 2nd brain :)
dranoel1963 1 year ago
@dranoel1963 change .rotation to .Rotate make sure to use a capital R
jamesusespivot 8 months ago
Is there a C# version of this? I'm having quite a big difficulty making it work in C#
Pottsy98 1 year ago
@Pottsy98 Ummm, currently no, but I may go over it this weekend.
Though I do recommend going through the Advanced AI series, as they are a whole lot more advanced, and a whole lot more useful. Though if you need the Multi-waypoint specifically, I will record one this weekend, maybe. Depends on how busy I am.
steamisM50 1 year ago
K, now I made another waypoint, but once the enemy reaches the waypoint, he has a seizure and doesnt go to the other point. My waypoints are empty game objects, would that mess it up?
Dnoop4life 1 year ago
@Dnoop4life No, it wouldn't. He may not be getting close enough to the waypoint. try bumping up the distance you have to be away from the waypoint a bit and it will work. The higher the value, the smoother the curve. I'd go with like... 0.5f to 3f, based on how smooth you want it to be.
steamisM50 1 year ago
uuuhhmm i have a problem, i want my enemy to face the way he is going to, how do i do that??
Milan0ka 1 year ago
uuhmm i have a problem my enemy is a sphere with eye's but when it moves its rotating, how can i stop that???
Milan0ka 1 year ago
@Milan0ka use transform.LookAt()
chiibachan28 1 year ago
Comment removed
Milan0ka 1 year ago
Comment removed
jerryisrippin 1 year ago
@jerryisrippin Ummm, length is how you get the amount of objects in an array.
For instance:
var Woopy : Transform[];
//... other code here
for(int i = 0; i < Woopy.length; i++) { }
Make sure you have the period between the array name and length, otherwise you will get errors.
steamisM50 1 year ago
Comment removed
jerryisrippin 1 year ago
@jerryisrippin Sorry, I do not have this script anymore, as this series is old.
steamisM50 1 year ago
This has been flagged as spam show
@steamisM50 oh well dont worry ill have to keep trying :P
jerryisrippin 1 year ago
Comment removed
Mattchu1995 1 year ago
omg dude ur channel is failing i cant add anything of ur videos to favorites :@
dranoel1963 1 year ago
how do we make in multiplayer so that we have 1 player controlling hes OWN character? i cant figure that out
dranoel1963 1 year ago
It is not going into the if statement if(moveDirection.magnitude < 1)
Slim08PU 1 year ago
@Slim08PU If the enemy is too tall, and thus, the center is too far away from the waypoint, then it won't switch, so, try increasing the value (instead of 1, try 5)
steamisM50 1 year ago
I am having problems. My enemy goes to the first waypoint and gets stuck and wont go to the others.
Slim08PU 1 year ago
@Slim08PU
in the code to switch Waypoints, put in Debug.Log("I have switched"); and see if that is ever fired, if so, it is switching it, it just can't move to it, or you are assigning a null, if not, then maybe you are doing your distance check between current waypoint and enemy wrong, and you may want to check that out.
I hope this helps. :)
steamisM50 1 year ago
Maybe you can help me: i have 5 waypoints + 5 buttons and want to let the enemy go to waypointX, if the user klicks buttonX. Tried to create a function Goto(X), but that doesnt work. Could you give a hint?
Great videos, btw!
beliebigerusername 1 year ago
@beliebigerusername On the press of a button, run a function that sets the target to the waypoint, and with how I set up the movement code in this, as long as the AI isn't at the waypoint, he will go to it, so you just use that movement code. I hope this helps!
steamisM50 1 year ago
dude this would really help out your videos if you helps us more i dont know you even got the waypoints and plus i had to pause your video make a script then copy it all down and save the same name as your script witch is really hard to see btw... but other thatn that i like your videos
r3ist3 1 year ago
@r3ist3 The waypoints were from the first part of the tutorial, the 1 waypoint system, I had created the waypoints, in this one, if there was any difference in waypoints, it was just copying some more out. As for the scripts, if they are in Javascript, they don't need to be the same name, if in C#, they have to be same as classname. There is no need to make it the same as mine. Also, I DO say what I am typing (mostly) so you should be able to follow along.
steamisM50 1 year ago
thanks so much mate :)
technochook 1 year ago
its going to the 2nd waypoint and stays there.... :(
dranoel1963 1 year ago
have to make sure you tell it to reset the waypoint (thats what I was implementing with Loop)
steamisM50 1 year ago
I am working on unitey's tutorial on a simple fps but in tut 3 it tells me to drag the AutoWayPoint script
Where can I find this script or could you reply the script because I don't know the script nor where to find it thank you for your time
girlinthegarden 2 years ago
You have to make it, it is the script we make here, but it isn't "AutoWayPoint" try rewatching... if you are following along, you should of created it already
steamisM50 2 years ago
@girlinthegarden So, I just reread your question, and if you are trying to do the tutorials from Unity Website, don't ask me for help for those, because I have never done them. If you were asking for help with my scripts, I hope I helped :)
steamisM50 1 year ago
Hey I tried doing this tutorial for a basic game i'm making but it doesn't appear to be working for me. What version of Unity do you have? (not sure if that would make the difference or not)
I'm making a 3d sidescroller and when i implement this script it changes the starting location of my camera and freezes everything. no errors come up
ApatheticJedi 2 years ago
Not sure why it would do this. you may want to check your settings for your other things, and you may want to make sure you aren't trying to control the character AND do waypoint stuff at same time.
I was using 2.5 in this tutorial I believe, but that shouldn't make a difference.
steamisM50 2 years ago
Hello. Great tutorials!!! Btw. if you remove waypoint[0] = transform; from Awake() functions, all work fine - no need 3 waypoint etc. Sorry for bad english :)
TheSargeros 2 years ago