- Home /
How to make spawn parameters
I'm making a game where you have to find a box hidden on the map and come in contact with it (Like Hide and seek)
However, I need to spawn the box within spawning parameters (Withing Edge to edge of the terrain.) Does anyone know what I would use in C# to make the parameters?
You could just try using a empty game object, checking it's size and coordinates and try placing the cube inside of that empty game object, but assu$$anonymous$$g that your terrain won't be just a flat surface without any bumps/walls/etc. this most probably wouldn't work unless you try checking if the cube is touching any other level geometry.
You could also try using several empty game objects, pick one at random and then try to place it inside that object or perhaps cast a ray at the top of the terrain towards the terrain (randomly that is) and just spawn the cube where the ray hits the terrain (in which case ceilings would be a limitation)
Really depends on the level geometry and how complex or easy you want it to be.
well, I did make the spawn work...sort of. it just loops the spawning of it over and over. but for now i've isolated the script and will work on it, in the mean time i made my game with default placed characters.
Your answer
Follow this Question
Related Questions
Logical Error In Spawn Counter (Javascript) 2 Answers
2D Spawn with fixed random locations 0 Answers
How to Spawn a Gameobject According to a Timer? 2 Answers
Spawning Creatures 0 Answers