Hi,
I have a bunch of objects in my game with box colliders (triggers). They randomly spawn at 5 different locations. I want to make sure they don’t spawn on top of each other (ie if one tries to spawn on another one, choose one of the 4 other locations instead).
I’m thinking the best way to do this would be spawn the object, test for collision with another object, and if there is collision then move it to one of the other 4 locations, repeat the process until it finds a location with nothing. All this should happen before the draw call so the player won’t see anything.
My question is, how can I check the collision without having to use the OnTriggerEnter callback? I’m assuming this function would be called in the next frame, after the draw call. Is there anything like action script 3’s hitTestObject to test if the collider is currently colliding with something?
Also, if anyone thinks I’m way off the beaten track and should be doing this a different way, please enlighten me ![]()