- Home /
How can I make character assets walk a certain distance?
I recently bought Simple Zombies and the zombies only walk on the spot and I would like to know how to make them walk a certain distance
How can I do that please?
Answer by Buckslice · Dec 12, 2017 at 09:48 PM
Build a Navmesh and then add a NavMeshAgent component to the zombie. Theres a simple script in the second link that should do the job for you. Hope this helps!
Second link is the blue highlighted word ‘Nav$$anonymous$$eshAgent’. Click on it and it takes you to the website.
Answer by KittenSnipes · Dec 14, 2017 at 01:47 PM
Or you can calculate the distance to the certain point
Such as:
//MaxDistance to objective is 3 as an example
public float maxDistance = 3;
public GameObject destination;
if (Vector3.distance(transform.position, destination.transform.position) >= maxDistance) {
movement.enabled = false;
}
Your answer
Follow this Question
Related Questions
Error with my strafe animations on player 0 Answers
What's the difference between animation and animator ? 0 Answers
How to play animation when player is moving? 2 Answers
how to make a irregular ground or slope,About irregular terrains and slopes 0 Answers
Changing speed of running animation 1 Answer