Hey Folks
I was looking for an “check if space is empty” function … unfortionatly I was unsuccesfull so far. Do you ever needed a function like that and if yes how did you achieve it?
Cheers!
Dawnreaver
Hey Folks
I was looking for an “check if space is empty” function … unfortionatly I was unsuccesfull so far. Do you ever needed a function like that and if yes how did you achieve it?
Cheers!
Dawnreaver
As for checking if a area is clear for a player to spawn?
My game finds spawns by checking objects for their spawnpoint tag “spawnpoint” and then picks a random one.
I use a prefab for spawns that have a trigger collider over it.
So when something is in the trigger over a spawn I simply removes the tag so the spawn code can’t find that paticular spawn when it needs to spawn a player. As the player/object leaves the trigger, the tag is set back for future spawns.
function OnTriggerStay()
{
tag = "Untagged";
}
function OnTriggerExit()
{
tag = "spawnpoint";
}
function Reset ()
{
collider.BoxCollider.isTrigger = true;
}
Well no … it’s more like I’d like to spawn a crate infront of the player, when the space is empty.