Creating a Sliding Door

From C4 Engine Wiki

Jump to: navigation, search
Image:warning.jpg Obsolete Article

Some or all of the information on this page is obsolete and needs to be updated.

The demo game that ships with C4 contains a generic controller that can be used to create sliding doors. Doors can move either horizontally or vertically, can be activated by firing a projectile at them or via a script using a trigger, a panel or an interactive object. In this tutorial our door will open by firing a projectile at it. Sliding doors may have an opened, moving and closed sound attached to them.

Two world files are available for download to accompany this tutorial. "Door.wld" and "Door_Tutorial.wld". The former is the completed, finished product whilst the latter, which we'll be using for this tutorial, is a pre-built world without the sliding door.


Download the world sample files here: DoorTutorial.zip


Contents

Step 1 — Create the necessary nodes

The door controller comprises of three nodes in addition to the actual door geometry. The first is a group node that our door geometry will be placed in. This node will contain our door controller. The other two nodes are locator markers that will tell the door controller how far to move the door and in what direction.

Begin by creating the door geometry. Open the "Door_Tutorial.wld" and you will see an opening for a door to be placed. Using a box primitive, draw out a suitably sized door and move it into position.


Image:Door01.jpg


Once the door is in position, select it and hit Ctrl-G. This will place the door geometry within a group, the node of which we'll be using in the next step. This group node, that appears as a green ring in the world editor, will be used to create the door controller and to create the "OPEN" and "CLOSE" connectors.

Create two locator markers. Position one at the point where you would like the door to be once opened and the other where the door is to be when closed. The actual position of the markers doesn't really matter, just the distance and direction between them.


Image:Door02.jpg


Step 2 — Create the connectors

Select the group node that our door geometry resides in and hit Ctrl-I (Cmd-I on the Mac) to open the Get Info dialog. Then go to the Connectors pane and click the New button at the bottom of the pane twice. Fill in the two connector identifier fields with the four-character codes OPEN and CLOS, in either order. Be sure to use capital letters because the door controller looks for these exact codes. You may choose Marker from the node type menus next to the identifiers, but this isn't strictly necessary. After creating the two connectors, the dialog should look like the following screenshot. Click OK (or hit Enter) to close the dialog.


Image:Door03.jpg


Step 3 — Connect the connectors

Once the connectors have been created, we need to link them to the two locator markers. This is done using the Select and Connect tool, which is described in more detail in the Using Connectors article. Select the OPEN connector and link it to the corresponding locator marker, then select the CLOS connector and link it to the other locator marker. Once this step is complete, you should see something similar to the following screenshot.


Image:Door04.jpg


Step 4 — Assign and configure the controller

The final step is to assign the door controller. Select the group node and hit Ctrl-I to open the Get Info dialog again. Go to the Controllers pane and select the Door controller from the list. The settings for the door controller will appear in the window as shown below.


Image:Door05.jpg


Fill out the various fields of the door controller as shown in the image above.

You are now ready to save your world and try out your new door.

Personal tools