Before updating to Windows 10 you may need to return your Pro license. More information here

falling block bridge

I have a bridge set up of 20 blocks. I have a script on my character that when he touches a button it starts. I want the bridge to fall 1 block at a time starting from one end to the other. what would be the best way to do this?

more ▼

asked Jul 30, 2010 at 07:26 AM

avatar image

12 6 4 4

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Get an array of each block, in order, via script. Then something like this:

// C# // Assumes you have "GameObject[] pieces;" already set up.

IEnumerator BridgeFall() { for(int i = 0; i < pieces.Length; i++) { pieces[i].rigidbody.gravity = true; // or however you make them "fall".

     yield return new WaitForSeconds(1);
     // or however long you want to wait for.


Then, just start the coroutine with StartCoroutine(BridgeFall()); whenever you wanted it to fall.

more ▼

answered Jul 30, 2010 at 08:52 AM

avatar image

13.3k 93 173 259

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: Jul 30, 2010 at 07:26 AM

Seen: 1207 times

Last Updated: Jul 30, 2010 at 07:26 AM