I need to reset my player with pre-set position and orientation.
I have an arbitrary number of cube's (with correct orientation and positioning) around my level. I could like to check the player distance against all of them, and spawn him on the closest available point.
The question, is how can I get all of those objects into a built-in array in my Start() function? To simplify things, they are all a child of an object called SpawnPoints.
So, I need the blanks filled in here..
var spawnPoints : Transform[];
function Start()
{
// Find all the children's transforms of SpawnPoint (which could be about 30 or so, who knows) and put them into the array.
}
function Spawn()
{
// This bit I know how to do :)
// Check distance
// Spawn from the nearest and match orientation
}