I have a bunch of cube objects in my scene, they have rigidbodys but are set to isKinematic = true.
When the player touches one of these blocks, I want to 'awaken' this block (set isKinematic = false so the block then responds to physics) and at the same time 'awaken' any other blocks which are touching it.
At first I tried doing this with collision detection but it's very buggy and occasionally doesn't work... so I'm trying to think of a more reliable solution. Since the setup is 2D, I was thinking that perhaps I could cast 4 rays, up down left and right, and if those rays collide with another other 'blocks', awaken them too.
I was wondering a) If there is a faster, more performance friendly way of achieving this and b) Is there a way the blocks can listen for Ray hits from other blocks?
What's the purpose of these blocks being set to isKinematic = true in the first place?
If it is solely so that they remain still (eg, suspended in the air) without physics acting on them, you can use the Sleep() function instead (put it in their Awake/Start function so that they sleep immediately on loading). This means that as soon as they are touched by an active physics object, they will awaken and begin to act as a normal physics object.
answered Oct 18 '10 at 09:32 PM