User:ThePaperDog/Rotating Button

From Valve Developer Community
Jump to navigation Jump to search

HOW TO MAKE A ROTATING BUTTON TURN (SWITCH ON/OFF)

File:Bttn Intro.png


Introduction:

In HL2, EP1, EP2; players occasionally encounter a scenario, where they must toggle a (rotating) button in order to achieve an effect or progress in the game. This page will describe steps on how to build a functional Rotating Button prop for use in your custom map, where:

  • The player can +USE the button object and it will turn to the ON position.
  • With the Toggle flag option checked, the player can repeat the +USE action and the button object will turn back to the OFF Position.
  • With the Toggle flag option unchecked, the button object will automatically return to the OFF position.

REQUIRED ENTITIES AND OBJECTS

1) FUNC_ROT_BUTTON (This is a brush-model entity.)

a) Create a new texture brush on your map.
b) Use your editor's 'MOVE SELECTED TO:' feature to convert the brush from World to Entity.
c) Set the entity's class as a func_rot_button.
d) Name the entity as "Func_for_Bttn"
e) Select and apply the brush-texture: "Invisible" to the entity.
f) Set the following flags
  • Not Solid Checked
  • Toggle Unchecked (optional)
  • X Axis Checked
  • Y Axis Checked
  • Use Activates Checked

2) PROP_DYNAMIC (This is a point entity (Button prop).)

a) Place a new prop_dynamic entity on your map.
b) Select its world model skin as: [Props_Citizen_Tech/firetrap_button01a.mdl]
c) Name the entity as "Bttn"
d) Select its Parent as [Func_for_Bttn]

3) PROP_STATIC (This is a point entity (Buttonpad prop))

a) Place a new prop_static entity on your map.
b) Select its world model skin as: [Props_Citizen_Tech/firetrap_buttonpad.mdl]
c) Naming this entity is not required

SET INPUTS/OUTPUTS (I/O)

1) Set the following output trigger(s) in the (Func_for_Button) brush's I/O.

Bttn Func IO.png

ALIGN AND GROUP THE OBJECTS

1) Place the (Func_for_Button) brush over the (Bttn) entity, making sure that (Bttn) is completely enclosed by (Func_for_Button).

2) Expand the size of the (Func_for_Button) to allow enough accessible interaction between the brush and the player.

3) Center the origins for (Func_for_Button) and (Bttn). Ensure that (Func_for_Button)'s origin is as closely aligned with (Bttn)'s origin as possible. This may require some adjustment to the size and area of the brush over the prop.

4) Set the Pitch Yaw Roll (Y Z X ) values for the (Func_for_Button)and (Bttn). Make sure the values for both match each other. NOTE: If you move these objects to a different position in the map, repeat this step.

5) Group the objects. (You can also save the finished group as a pre-fab)

NOTES

See also: WORKING WITH AXIS, ORIENTATION AND ORIGIN

--The PaperDog 20:16, 8 March 2009 (UTC)