Uploader Comments (steamisM50)
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; }
All Comments (83)
-
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?
What the hell why dont you just use "look at" it seems like your trying to make your life confusing
VirtualSpoof 2 months ago
@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.
steamisM50 2 months ago 3
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 5 months ago in playlist Unity3D AI Tutorial
@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)
steamisM50 5 months ago
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 6 months ago
@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.
steamisM50 6 months ago