- Home /
first random positon is always the same
void Wander() { wayPoint = new Vector3(Random.insideUnitSphere.x 8, transform.position.y, Random.insideUnitSphere.z 8); timer = timer - 1 * Time.deltaTime; if (timer <= 0) { agent.SetDestination(wayPoint); timer = Random.Range(4f, 6f); target.transform.position = wayPoint; } }
the fist random is always on a location that isnt in the circle and i dont want always to have the same location
Answer by aurelioprovedosocialpoint · Oct 31, 2017 at 05:22 PM
You need to call Random.InitState() at the start of your game.
Use a different value everytime you start the game. For example: Random.InitState((int)System.DateTime.Now.Ticks);
Answer by $$anonymous$$ · Oct 31, 2017 at 08:56 PM
is the insideUnitSphere on the object where the script on is
Your answer
Follow this Question
Related Questions
Can you randomise a Navmesh agents rotation 1 Answer
Add randomness to Navmeshagent 0 Answers
[SOLVED] NavMeshAgent Create Imperfect Paths? [SOLVED] 1 Answer
AI pathfinding waypoints 1 Answer
How do I change Nav Mesh Agent Speed with c# Script ? 2 Answers