Rotating Button

From Valve Developer Community
Jump to: navigation, search
Wikipedia - Letter.png
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)
Dead End - Icon.png
This article has no Wikipedia icon links to other VDC articles. Please help improve this article by adding links Wikipedia icon that are relevant to the context within the existing text.
January 2024

Button Normal2.png


Introduction

In HL2, EP1, EP2; players occasionally encounter a scenario, where they must toggle a (rotating) button 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

Place, Align, and Group the objects

Follow these steps:

  • Center the origin of the prop_static entity ( the button pad).
  • Place the prop_dynamic entity "Bttn" into the desired position on the button pad.
  • Place "Bttn" and button pad into the desired position on the map (i.e equipment console or a wall)
  • Set the desired Pitch Yaw Roll (Y Z X ) values for entity "Bttn".
  • Center the origin for "Bttn".
  • Align "Bttn"'s origin with the prop_static's origin as close as possible.
  • Place the momentary_rot_button brush entity "Func_for_Bttn" over "Bttn", making sure that "Func_for_Bttn" completely encloses "Bttn". Allow enough extension of "Func_for_Bttn" for the player to touch it.
  • Center the origin for "Func_for_Bttn".
  • Align "Func_for_Bttn"'s origin with "Bttn"'s origin as close as possible.
  • Set the (X) and (Y) values for "Func_for_Bttn" equal to the (X) and (Y) values of "Bttn". (Note; If you move and/or re-orient these objects to a different position in the map, repeat this step.)
  • Group all the objects. (You can also save the finished group as a pre-fab)

From "The PaperDog"