- Home /
How can I instantiate rigid bodies on top of each other without them exploding away?
I'm trying to quickly spawn a number of rigid bodies from a single point but because they spawn quicker than gravity can pull them away they are spawning on top of each other which is causing them to rocket apart rather than fall in a nice stream.
The presentation is important, so I'm looking for a solution that allows me to keep the spawn rate nice and snappy as it is now.
I feel like ideally, when a rigid body instantiated inside another, it could mark the other rigid body as a "no collide" until they moved outside each other's bounding box, after which they would collide like normal.
Does this functionality already exist and I'm just not savvy to it? Has anyone written something like this on their own? Any suggestions for how to go about it? Any totally different and potentially better solutions?
Thanks!
Awesome, thanks robertbu. If I ever do a full-on solution like my ideal scenario above I'm sure that will be invaluable.
Answer by Slobdell · Aug 08, 2013 at 03:00 AM
First off the Rigidbodies don't collide it's the colliders that do. You could disable them all together, or set them inactive initially and have them turn on after a certain time or when they reach a certain point or some other trigger. Or What I have done is when instantiating them you could apply a force so that they get pushed out of the way before the next one is instantiated.
This will probably be the most appropriate combination of solutions. Thanks for your input!
Answer by BlueFireDev · Aug 08, 2013 at 03:09 AM
Turn gravity off, move to open space in script, and then turn gravity on? That's what I've done.