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

Building a Turning Platform

Building a Turning Platform

Oct 05 2018, 7:43 PM PST 10 min

In the Making Your Own Obby Game tutorial, you created a basic obby. In this tutorial, you’ll create a tricky turning platform that makes players jump with perfect timing to land safely on it.

Creating the Base and Platform

The turning platform will spin around and around like a clock hand, but it needs a solid “base” to be anchored to, otherwise it will just fall down into space.

Create the Base

Our base can be a simple block, anchored in place.

  1. Somewhere near another platform in your obby (but not too close), create a small Block.
  1. Anchor the new part in space.

Create the Platform

Next, create the platform that will eventually spin around and around. Position this platform so that it sits on top of the base you just created.

Name the Parts

As always, it’s a good idea to name these new objects so they’re easy to find in the Explorer window.

  1. In the visual game editor window, find and select the platform base part that you created. In the Explorer window, that part will be highlighted.

  2. Right-click on the part’s name to show a menu of options and select Rename.

  3. Type in PlatformBase.

  1. 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. For this part name, type in TurnPlatform.

Attaching the Parts

The basic setup of the base and platform is done, but there’s nothing special about it yet. In fact, if you run your game now, the platform will probably just fall off the base and down into space. Let’s fix that!

  1. To get a better view of things before you add a hinge constraint, move the platform directly up a few studs.
  1. Select the platform base 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 PlatformBase).

  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 base part. Carefully move your mouse over the part until the attachment is centered.
  1. Click the mouse button to add it.

  2. Adjust the camera view so that you can see the bottom of the platform (TurnPlatform) located above the base part.

  1. Carefully move the mouse over the bottom of the platform until the second attachment is positioned directly above the first attachment, then click the mouse button to add it.

Making it Spin

In the Explorer window, find and expand the branches for both PlatformBase and TurnPlatform. Here you can see the new constraint objects:

Object Description
Attachment0 This is the first attachment you added, connected to the top of the PlatformBase part.
HingeConstraint This is the actual hinge constraint.
Attachment1 This is the second attachment you added, connected to the bottom of the TurnPlatform part.

At this point, the turning platform is very similar to the hinged platform you created earlier — it can spin around the hinge point but there’s no power to drive it. Fortunately, a hinge can also be made into a motor that turns the platform around and around!

  1. In the Explorer window, select the HingeConstraint object that attaches the turning platform the base.
  1. In the Properties window, look at the properties for the HingeConstraint object. You don’t need to worry about most of them, but there’s one very important property, ActuatorType, that makes a basic hinge into a powered motor.
  1. For this ActuatorType property, click in the area to its right and select Motor.
  1. Now look at the Motor section that appears slightly below in the same window. To make the platform turn, you need to type in a new value for AngularVelocity. This value tells Roblox how fast the motor should turn — in this case, a value of 0.5 should be fine.
  1. Finally, change the value of MotorMaxTorque to 1000. In your future game design, this value may need to be even higher for a motor to turn a very big, heavy part.

Finishing Up

Now let’s test the turning platform and make sure it works! Press the Play button:

If you did everything right, the turning platform should now spin around and around. The player’s challenge is to jump on the platform at the right time, then let it carry them around until they can safely jump off to another platform.


Amazing job! Now your obby has another cool obstacle which challenges players to jump and move with greater skill.

Where next? Check out these tutorials which can help push your game to an even higher level.

Tags:
  • gameplay
  • constraints