- Home /
Duplicate Question
HOW TO MAKE A NPC GO FORWAR
I am simply looking for a script to make an npc move forward in a straight line with no animation, make a noise and the movement to be very quick so it is startling. Please help i am very new to this!
I usually use animations when I have to deal with movement but here is something that may work.
var npc : Transform; var speed = 0.1;
function Update () { npc.transform.position.z -= speed; }
This is not tested and I'm not on the computer, but let me know if it works.
https://docs.unity3d.com/Documentation/ScriptReference/Transform-forward.html
You don't say if you are using rigidbody/forces or charactercontroller, but for either there are many posts, video/tutorials and code snippets that explain it.
He could simple use an animation to do that, it would be much easier but yeah there are lots of ways to do it.
https://www.youtube.com/watch?v=6hRU9hXGFQA in this use basic wayPoints
http://www.fpscontrol.com/ you can find good stuffs here to (Free) included waypoints
Follow this Question
Related Questions
Boundaries for Camera Movement 1 Answer
How to make fish movement with keyboard arrows look natural? 1 Answer
Walljump 2D doesn't work why ? 1 Answer
How to code a burst of speed? 1 Answer