Added: 2 years ago
From: steamisM50
Views: 19,474
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (68)

Sign In or Sign Up now to post a comment!
  • Comment removed

  • just so people know, if you want the enemy to look at the waypoint, add

    transform.LookAt(waypoint[curr­entWayPoint]);

    directly below

    velocity = moveDirection.normalized * speed;

  • can you get him to wait at each waypoint for a few seconds?

  • 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 If you go check out my A* tutorials, they cover the exact behaviour that you are asking about.

  • @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? (:

  • thanks i love the tutorials :D subbed :)

  • 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 Check to make sure the class is the same name as the file. It won't work otherwise.

  • @steamisM50 Ok forgive me for asking but where/what is the class?

  • @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 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/f250bb76f0c84b84fa663eb4e­2b7d666.dll to

    Library/ScriptAssemblies/Assem­bly-UnityScript.dll

    Failed: Access is denied."

    Do you have any clue what that means??

    Its very annoying, it pops up all the time...

  • 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.

  • you're awesome, your tuts helps me a lot...

  • Very good tutorial. Helped me out a lot.

  • thanks man this was great.

  • 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

  • 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

  • your tutorials are my first ai tutorials and they are good so far so thanks

  • @steamisM50

    Lol never mind fixed my problem.

    Thanks for the awesome tutorial. : )

  • @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.

  • 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 cant make it loop, it just goes to the 1st one

  • @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..

  • @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...

  • Comment removed

  • Comment removed

  • @steamisM50 ok ok i got it, i used waypoint[currentWaypoint].rota­tion

    thanks for opening my 2nd brain :)

  • @dranoel1963 change .rotation to .Rotate make sure to use a capital R

  • Is there a C# version of this? I'm having quite a big difficulty making it work in C#

  • @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.

  • uuuhhmm i have a problem, i want my enemy to face the way he is going to, how do i do that??

  • 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 use transform.LookAt()

  • Comment removed

  • Comment removed

  • @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.

  • Comment removed

  • @jerryisrippin Sorry, I do not have this script anymore, as this series is old.

  • Comment removed

  • omg dude ur channel is failing i cant add anything of ur videos to favorites :@

  • how do we make in multiplayer so that we have 1 player controlling hes OWN character? i cant figure that out

  • It is not going into the if statement if(moveDirection.magnitude < 1)

  • @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)

  • I am having problems. My enemy goes to the first waypoint and gets stuck and wont go to the others.

  • @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. :)

  • 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 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.

  • thanks so much mate :)

  • its going to the 2nd waypoint and stays there.... :(

  • have to make sure you tell it to reset the waypoint (thats what I was implementing with Loop)

  • 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

  • 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 :)

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more