Ok...so I have a bunch of floor tiles whose rigidbody physics I want to activate only after being within the blast radius of a grenade or other large explosive...then, if possible, I'd like to deactivate the rigidbody physics after about seconds. I have already built the floor and applied physics properties to the individual tiles, but I don't want them to be constantly calculating physics properties and bogging down the CPU...Currently they're either always on or always off. How should I go about doing this? Thank you very much in advance to all who contribute...and major kudos to the company that just produced the almost-perfect engine for my game. Thanks again.
Rigidbodies are switched off automatically if they are inactive for a while: http://otee.dk/forum/viewtopic.php?t=313&highlight=stopped Richard. PS Yip Unity is awesome!!
Yes, but my problem is that these tiles, unless stopped within a certain time limit, will keep moving and thus prevent the automatic stopping from kicking in. If the stopping mechanism could be changed from a velocity test to a timed test only for specific objects, and be made to still reactivate when a force is applied, then that is what I am looking for. I also have the problem of overlapping collision boxes...when rigidbodies are turned on this causes the floor tiles to jump out of their places on the floor...so if the rigidbody script could be activated only when the tiles have been impacted by a blast greater than or equal to a certain damage level and then deactivated after ten seconds (and still be reactivatable by a similar blast), that would be perfect. Attached is a shot of the floor.
I don't know of any direct method of deactivating only the rigidbody component of a gameObject. So, other possibliies are: 1. Create the tiles without rigidbodies, then, when you need the blast, add the rigidbody component ( gameObject.AddComponent("RigidBody")). I don't know how to remove the rigidbody component once you have created it though 2. If you need to repeatedly "activate" and "deactivae" the rigidbody then one way is to have two identical gameObjects for each tile, one with a rigidbody and the other without and then swich their gameObject activation states around after transfering their position/rotation info - haven't tried it myself so not sure how well it would work. Cheers, Richard.