Unity 3d AI Tutorial 2 - OneWaypoint system

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
24,785
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Dec 21, 2009

In this tutorial, we create a single waypoint waypoint system, so that you can tell your AI to go to a point and sit there... great for cinematics.

Category:

Education

Tags:

License:

Standard YouTube License

  • likes, 6 dislikes

Link to this comment:

Share to:

Uploader Comments (steamisM50)

  • What the hell why dont you just use "look at" it seems like your trying to make your life confusing

  • @VirtualSpoof LookAt() is a very harsh turning, and turns to exactly that point without any smooth rotation. This way, the character smoothly turns to where it needs to look, making for more realistic turns.

  • i am having a problem, when i try and link the psd waypoint file nothing at all is happening, iv copied the code exactly (accept for the string), what is the waypoint object made of too? im trying to use an empty game object. i am new to unity so i dont fully understand this

  • @FantasyAddictP Make sure the string is exactly the same, and make sure that the name of the file is exactly the same in the exact same place. It can't be in any other place, or it won't work. It is just an empty object.

    If you are using the newest version of Unity (which I am assuming you are) they MAY have changed this, but I am not 100% sure (I haven't touched Unity for a while)

  • I Have a question. I need to change the centre of y rotation of my object to more further back. How do I do it? Thanks

  • @uuuserunknown What I would do is to make an empty game object that is the "center" of the character, bus, w/e, so that you can easily change where the model is in relation to its parent "center" object. This is what I do for pretty much any character that has a custom model that I bring into Unity.

Top Comments

  • hey if your lazy and dont want to type anything copy and pace this

    var waypoint : Transform;

    var speed : float = 20;

    function Update () { var target : Vector3 = waypoint.position; var moveDirection : Vector3 = target - transform.position; var velocity = rigidbody.velocity; if(moveDirection.magnitude<1){ velocity = Vector3.zero; } else{ velocity = moveDirection.normalized*speed­; } rigidbody.velocity = velocity;

    }

see all

All Comments (83)

Sign In or Sign Up now to post a comment!
  • got download example ? i'm new with unity

  • How do you get a 'waypoint' into your scene? Or is it just an empty? I can't tell??

  • damit i couldnt see anything your typing cause it was small and when i enlarged the player it got blurry more

  • for those that wanna skip the boring image scaling part skip to 3:30

  • Oh and also how can i get him to face the waypoint as he walks there? like right now he flies backwards at it haha :D anyway thanks a bunch, and sorry for the questions, im new to this :D

  • Thank you very much, this helped a lot but i have 2 quick questions, how would you incorperate a walking animation into this? like in psuedo would it be kinda like if (moving = true){play walk.animation} or something? and also i have a curvy terrain with hills and mountains, so how would i get the enemy to follow the terrain, so not just float through mountains and stuff. Again though, thank you very much!

  • You know before you make tutorials, you should know what you're doing.

    Clearly, you don't.

  • ok so i have a slight problem my ai dude decides to float in the air on his way to the waypoint instead of staying on the ground any help plz?

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