Building a Hinged Platform
Building a Hinged Platform
articles/Creating Your First Game|Making a Basic Platformer tutorial, you explored Roblox Studio and you designed a basic obstacle course. In this tutorial, you’ll create a tilting, see-sawing platform that players must overcome.
Creating the Support and Platform
The hinged platform will tip back and forth as the player walks on it, but first it needs an anchored support or it will fall down into space.
Create the Support
The support can be a simple block, anchored in place.
- Somewhere between two other platforms, create a small block.
- 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 the final assembly balances. Also consider
articles/Making Your Obby Colorful|applying a different color so that players recognize it’s not a typical platform.
Name the Parts
As you design bigger and better games, it’s a good idea to enter custom names for important parts so they’re easy to find in the Explorer window.
- In the game editor window, select the platform support that you created.
- In the Explorer window, right-click the part’s name and select Rename.
- Enter in PlatformSupport.
- Back in the game editor window, select the platform part itself. In the Explorer window, rename the part to HingePlatform.
Attaching the Parts
Now that you have two parts for the hinged platform, it’s time to attach them. In Roblox, constraints attach two parts together and let you create special behaviors for them.
- To get a better view of things before you add the constraint, move the platform away from the support by a few studs.
- Make sure that you’re viewing the Model tab.
- In the Constraints section, click the small arrow below Create and select Hinge.
- Move your mouse pointer into the game editor window and hover over the PlatformSupport part. Move your mouse until the attachment (green sphere) is centered on the surface facing the platform.
- Click the mouse button to add it.
- Adjust the camera view so that you can see the thin side of the platform (HingePlatform) located near the support part.
- Carefully move the mouse until the second attachment is positioned across from the first attachment, then click the mouse button to add it.
Changing the Mass
In Roblox, a part’s mass is internally calculated based on its size and density. If the hinged platform’s mass is too low, it will move too quickly and drop players off into empty space before they can reach the other side. If its mass is too high, the platform will move too slowly and players will just walk across it like a normal anchored part.
You can change the platform’s mass — regardless of its size — by adjusting its Density property.
- Select the HingePlatform part in the game editor window, or select it from the Explorer window.
- In the Properties window, find the Part section and look for a row named CustomPhysicalProperties (if necessary, expand the Part section by clicking the small arrow next to its name).
- Click the small checkbox inside its row.
- For the Density property, type in a higher value like 5.
To finish up, move the HingePlatform part back against the PlatformSupport part.
Now press the Play button to test. When you jump onto the platform, it 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.
Now your game has a dynamic obstacle which challenges players to balance with greater control. Where next? Check out the tutorials below for more ideas and inspiration.