- Home /
AI spawning areas. What are the ways to make them?
I was thinking of making a gigantic collider and making a randomising code which would randomly pick a point given some ifs and linked to game time.
Is that good idea? Is it possible with a collider?
What other ways, better or worse are there?
Well, the way that I've done before is to actually pick points that will be good for spawning. You might find it completely satisfactory that new players can't spawn at any place in the map. $$anonymous$$y suggestion is to pick 5 points to start with. Have your AI use a rand to pick one of those 5 points as their spawn point.
Answer by clunk47 · Sep 12, 2013 at 05:39 PM
Why don't you just use some empty gameObjects and access their Transforms as spawn points?
OR
Use a random range for each axis in a Vector3.
position = new Vector3(Random.Range(0, 100), Random.Range(0, 100), Random.Range(0, 100));
Also have a look at Collider.Bounds if you HAVE to use a collider.
I don't want points like in skyrim or fallout, thats weak. I want properly random within a big area type spawning. The terrain can get very barren and open in most places so things getting spawned in shouldnt cause any issues with colliding. Also the way the AI is spawned makes them not appear instantly, so that nothing will just pop into your face.
What I need is a way for picking a random point wihin a collider. Is that possible?
I don't know about a collider specifically. You could make your own point generator though if you were given the coordinates you want to spawn in. Like if your colliders are spread throughout the level, and you want it to spawn within them (and they are large). Randomly pick a collider, and then generate a point (naieve implementation), that fits the constraints of the collider. I don't really know where Skyrim came from. I suppose I was thinking of Halo, where there are lots of points throughout the level from where you can spawn.
Use a random range for each axis in a Vector3.
position = new Vector3(Random.Range(0, 100), Random.Range(0, 100), Random.Range(0, 100));
Also have a look at Collider.Bounds if you HAVE to use a collider.
Ah ok clunk47. Thats what I wanted to see.
I can make those ranges within the size of a collider and use the collider to set the ifs of Players entering it and such.
Ok I think I have the basic idea now. Implementing it will happen soon, which will most likely include me running back here confused as usual.
Thanks dudes.