How would I generate a random point between two Vector3 locations.
I'm trying to implement A* pathfinding into my game which has so far proved successful. But now I'm trying to get a point to randomly generate for the AI to path find to that position and I'm having troubles with an error where I cant convert the randomly generated numbers to a Vector3. This is the portion of code where the problems are happening. void Start() { minimum = new Vector3(1.0f, 1.0f, 1.0f); maximum = new Vector3(10.0f, 10.0f, 1.0f); Vector3 random_position = new Vector3(Random.Range(minimum.x, maximum.x), Random.Range(minimum.y, maximum.y), 1); seekers = GetComponent<Seeker>(); rb = GetComponent<Rigidbody2D>(); seekers.StartPath(random_position.x, random_position.y, OnPathComplete); }
I'm pretty new to C# so I wouldn't be surprised if it was something dumb.