User:ThePaperDog/Rotating Button: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{essay}}
=='''HOW TO MAKE A ROTATING BUTTON TURN (SWITCH ON/OFF)'''==
=='''HOW TO MAKE A ROTATING BUTTON TURN (SWITCH ON/OFF)'''==
During the game, players will come across some physics scenarios, where they will need to switch a rotating button on/off to achieve an effect or desired progress in the game.  
[[File:Button Normal2.png]]
This page will describe steps on how to build a functional Rotating button prop for a custom map, where:
----


''1) The Player can +USE the button object and it will turn 90 degrees (ON position). ''
'''Introduction:'''


''2) With a toggle flag option set, the Player can repeat the +USE action and the button object will toggle back (OFF Position).  (or... Without the Toggle Flag set, the button object will automatically return to OFF position.)''
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:


== REQUIRED OBJECTS ==
* The player can +USE the button object and it will turn to the ON position.
1) Create a new texture brush and set it as a '''func_rot_button''' entity.  
* 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.


2) Ensure these flags are set for the function entity:  
== 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''


    '''Not Solid'''       ''Checked''    
2) '''PROP_DYNAMIC''' (''This is a point entity (Button prop).'')
    '''X Axis'''         ''Checked''
:a) Place a new prop_dynamic entity on your map.
    '''Y Axis'''         ''Checked''
:b) Select its world model skin as: '''[Props_Citizen_Tech/firetrap_button01a.mdl]'''
    '''Use Activates'''   ''Checked''
: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''


3) Create a new prop_dynamic entity and browse/set its world model/skin as model:
==SET INPUTS/OUTPUTS (I/O)==
1) Set the following output trigger(s) in the (''Func_for_Button'') brush's I/O.


  Recommended model: ''firetrap_button01a.mdl''  (The Button)
[[File:Bttn Func IO.png]]


4) Create a new prop_static entity and browse/set its world model/skin as model:  
== PLACE, ALIGN AND GROUP THE OBJECTS==
Follow these steps:


  Recommended model: ''firetrap_buttonpad.mdl''  (The Button Pad)
*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)


== SET OBJECTS' PARENT/CHILD RELATIONSHIP ==  
==NOTES==
Bind the function entity with the button entity by making the function entity the parent of the button entity.


1) Set the Name property for each of the entities (Give each entity a unique, meaningful name). For example:
See also: 
*[[User:ThePaperDog/WORKING_WITH_AXIS_ORIENTATION_ORIGIN | WORKING WITH AXIS, ORIENTATION AND ORIGIN]]


  (func_rot_button)           Name =  MyButtonRotator
--The PaperDog 06:16, 15 March 2009 (UTC)
  (prop_dynamic)  ''button''      Name =  MyButton
  (prop_static)    ''button pad''  Name =  MyButtonPad


2) Set the Parent property of the prop_dynamic entity to the name of the momentary_rot_button entity:  
[[Category:Level Design]]
 
  (prop_dynamic) ''button''      Parent = MyButtonRotator
 
== SET OUTPUTS ==
 
Set an output statement in the momentary_rot_button entity's OTIP settings (i.e. '''Output, Target, Input, Parameter Override''' settings in the entity's Properties | Outputs tab-page).
 
1) Use the following values:
 
  Output...    OnPressed
  Target...    MyButton
  Input...    SetAnimation
 
== GROUP THE OBJECTS ==
Drag the function entity over the prop_dynamic ''button'' entity, making sure that the prop is completely enclosed by the brush.
 
Once the entities are properly aligned, it is recommended that they be locked together as group entity. (Also recommend saving that grouped entity as a Prefab in the Steam directory.)
 
== NOTES ==
1)  The func_rot_button brush placement/position will effect the precision of button prop's dynamics.  For example, if the brush is moved away from its associated prop, the rotation performance of the prop will behave like a right/left/up/down lever, offset from the intended axis of the prop. A good practice is to make sure that the Origins for each entity are centered and aligned to each other. (You can experiment with the brush placement to illustrate this.)
 
2)  The natural inclination is to place the button prop on a wall.  Align the entities accordingly.
 
 
Updates pending: (button, rotating button, switch, switch pad, red button)
 
--The PaperDog 03:34, 18 February 2009 (UTC)--
 
Retrieved from "http://developer.valvesoftware.com/wiki/User_talk:ThePaperDog"

Latest revision as of 03:07, 7 January 2024

Icon-essay.png
This is an essay.
It contains the advice or opinions of one or more of the Valve Developer Community's contributors.
This page is not an encyclopedia article, nor is it one of the Valve Developer Community's policies or guidelines, as it has not been thoroughly vetted by the community.
Some essays represent widespread norms; others only represent minority viewpoints.

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

Button Normal2.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

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)

NOTES

See also:

--The PaperDog 06:16, 15 March 2009 (UTC)