PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience

Building a Hinged Platform

Building a Hinged Platform

Oct 05 2018, 7:42 PM PST 10 min

In the Making Your Own Obby Game tutorial, you learned the basics of using Roblox Studio and you designed a basic obby. In this tutorial, we’ll expand on what you learned to create an obstacle that players must overcome: a tilting, see-sawing platform.

Creating the Support and Platform

The hinged platform will tip back and forth as the player walks on it, but first it needs a solid support to attach to (otherwise it will just fall down into space).

Create the Support

Our support can be a simple cylinder, anchored in place.

  1. Somewhere near another platform in your obby, create a small Cylinder part.
  1. Anchor the new part in space.

Create the Platform

Next, create the platform that will tip back and forth. Make sure it’s centered left-to-right with the support part so that it balances.

Name the Parts

As you design bigger and better games, it’s a good idea to enter custom names for important parts. This helps you find those parts in the Explorer window when you need to change something about them.

  1. In the visual game editor window, find and select the platform support part that you created. In the Explorer window, that part will be highlighted.
  1. Notice that most parts are just named “Part” — that’s not too helpful, so let’s change it. Right-click on the part name in the Explorer window to show a menu of options, then select Rename.
  1. Type in PlatformSupport, a much better name for this part.
  1. Next, back in the game editor window, find and select the platform part itself. In the Explorer window, right-click on the part’s name and select Rename, just like you did for the support part. For this part name, type in HingePlatform.

Attaching the Parts

Now that you have two parts for the hinged platform, it’s time to attach them. In Roblox, one way to attach a part to another part is with a constraint. Constraints attach two parts together and let you create special behaviors for the parts.

Here are some examples of constraints in real life:

Object Parts Attached
Door hinge The door and the wall
Axle on a bike wheel The wheel and the bike frame
Boat propeller shaft The boat engine and the propeller
Your knee Your upper leg and lower leg

For this hinged platform, we’ll attach it to the support part with a Hinge constraint.

  1. To get a better view of things before you add the constraint, move the platform away from the support by a few studs.
  1. Select the platform support part in the game editor window or select it from the Explorer window (notice that it’s easier to find since you changed its name to PlatformSupport).

  2. Zoom in to get a better view of the part. Remember that you can also focus on the part by pressing the F key.

  3. Make sure that you’re viewing the Model tab.

  1. In the Constraints section, click the small arrow below Create and select Hinge.
  1. Move your mouse pointer into the game editor window and hover over the support part. You will see a small, bright green object called an Attachment — this tells Roblox exactly where to connect the start of the constraint. Carefully move your mouse over the side of the part until the attachment is centered, then click to add it.
  1. Adjust the camera view so that you can see the thin side of the platform (HingePlatform) located near the support part.
  1. Move your mouse pointer over the side of the platform. You’ll see a second bright green attachment which tells Roblox where to connect the end of the constraint. Carefully move the mouse until the second attachment is positioned across from the first attachment, then click to add it.

Great job! The red line that connects the two green attachment objects shows the new hinge constraint.

Changing the Weight

Imagine if this platform existed in real life and it was even bigger than you. If it was made from solid metal and you put an apple on one end, it probably wouldn’t move much. Why? Because the apple doesn’t weigh very much compared to the heavy metal platform.

Now imagine if the same platform was made from cardboard, like an empty box — if you put an apple on one end, it would probably tip down because the apple’s weight is enough to move the light cardboard platform.

For your obby, consider the same thing. When a player jumps onto one side, will the platform move so easily that the player is quickly dumped off into empty space? Or will the platform move so slowly that players can just stand on it like a normal anchored platform?

Set the Density

In Roblox, a part’s weight is automatically assigned based on its size (bigger objects will always weigh more than smaller objects). For this hinged platform, however, we need to change its weight to something different.

  1. Select the platform part in the game editor window or select it from the Explorer window.
  2. Open the Properties window by selecting the View tab and clicking the Properties button.
  1. Find the Part section and look for a row named CustomPhysicalProperties (you may need to expand the Part section by clicking the small arrow next to its name).
  1. Click the small checkbox inside the row.
  1. For Density, type in a higher value like 5.

Finishing Up

Time to test the hinged platform and see how it works!

  1. Press the Play button:
  1. Run and jump over to where you put this obstacle. When you jump onto it, the platform should tip back and forth like a see-saw. Your goal is to balance and move across it without being tipped off into empty space.

Great job! Now your game has a cool new obstacle which challenges players to balance with greater control.

Tags:
  • gameplay
  • constraints