# Physics bridge

1
• 37 favourites

### Stats

4,701 visits, 8,052 views

### Translations

• Spanish

Using bridges in a game can make some really nice gameplay.

While using a normal, static bridge is always nice, it's sometimes just to plain and nothing much can happen.

Therefor you can use physics to create your bridge.

With physics you can do a lot of cool stuff! Such as a rope bridge, sturdy bridge, bridge that goes up or a bridge that goes down.

The best part with a bridge, is that it reacts with its environment, making the game and the gameplay much more dynamic and fun!

To create a bridge is very easy, and now we are gonna look at how you can create one!

## Setup objects

First thing you need to do, is to create all objects you need.

The picture below is a good example on how it may look like:

Some things to notice is that each plank of the bridge is a single object. Do not create a copy of a object, because that won't work very well.

## Create physics

Now when you have setup all objects as you wish them to be, you need to physicalize all the objects.

You can do this, either by adding a physics behavior to each individual object, or, if you have a full license, create a family with only the bridge planks, and set the physics behavior on the family.

Don't forget to physicalize the other objects as well, most importantly, where the bridge will be connected to, and set these objects as "immovable".

## Connect the bridge

Now when all bridge planks are physicalized, and the ground on the sides are physicalized, we need to connect the bridge planks together, so they don't just fall, but stick together as if it was pure magic.

The trick here is to use physics joints! In this case, we use distance joints.

This part of the bridge creation is not much fun and little confusing, but extreme necessary! Look at the picture below:

As you can see, all objects are connected to each other.

Plank_1 is connected to the left side (which is immovable), and then Plank_2 is connected to Plank_1, and so it goes until the last plank, which is both connected to its previous plank as well as connected to the right side (which is immovable). This means all planks are connected as with a chain to each other as well with the ground on each side.

Important!

It's very important to where you set the image points for the ground (left and right side), because creating a joint between two points, Construct 2 uses a image point. In this example, for the left side ground

I set the image point at position "Top right side", so its position is at the top of the right side. And for the left side ground, I set the image point to "Top left side". See picture below:

The image point for each individual plank, you can leave in the center if you wish. You can also set the image point for the ground wherever you want, but changing the position may cause different results, so beware!

## Tips and tricks

So now, with a few steps you have a nice working hanging bridge that is fully physicalized and ready for anything!

So to get the bridge rolling, here is a few tips:

- If you want to use a character but don't want to use physics to move the character, then just add the "Solid" behavior to the ground and individual plank (or family). You get the exact same results, but you don't need to interact the character with physics.

- You wanna blow up parts or the whole bridge?

Then use the action "Remove all joints" on the specific object you want to destroy. So if you want for instance, the bridge to break in the middle; set the action "Remove all joints" on Plank_7, and the bridge will break in the middle.

- You want the whole bridge to explode?

Then you need to set the "Remove all joints" action on all objects (or family), and maybe add a (not too strong!) Impulse at a random angle (Use the "Apply Impulse at angle" action with a random angle) like so:

So now you have a physics bridge which you can use, and blow up at any time! Now you just need to check out the simple Capx example which contains a physics bridge:

http://dl.dropbox.com/u/52716812/Projects/Tutorials/Physics_bridge.capx