- Home /
Detecting collision from Instantiated objects
hey, i've written a quick script that spawns 500 cubes randomly in the volume of a sphere, however i've been unable to find a system to stop the Instantiated objects from intersecting when they spawn.
i know this SHOULD be possible, but with Unity's unhelpful obuste collision detection system i've found it very difficult to work out.
the cubes that i am spawning will be used as collision objects in the game, so they have colliders attached, but i've found no way to reliably destroy any cube that spawns inside another.
i've been trying to figure this out for two days now, so any help is welcome.
thanks in advance
Answer by DaveA · Sep 08, 2011 at 09:41 PM
You can iterate over each previously spawned object and check bounds: http://unity3d.com/support/documentation/ScriptReference/Bounds.Intersects.html
Thanks, i knew there must be a function like this, i just couldn't find it.
Your answer
Follow this Question
Related Questions
How can I instantiate rigid bodies on top of each other without them exploding away? 2 Answers
Error: Instantiated Enemies don't get hit 2 Answers
Two Objects Touching? 0 Answers
Spawning if there is space 1 Answer
Have a spawning issue on iOS 0 Answers