User:ThePaperDog/Rotating Button: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
=='''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.  
[[Image:Bttn_Intro.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). ''


''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.)''
'''Introduction:'''


== REQUIRED OBJECTS ==
In HL2, EP1, EP2; players occasionally encounter a scenario, where they must
1) Create a new texture brush and set it as a '''func_rot_button''' entity.
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:


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


    '''Not Solid'''      ''Checked''    
== REQUIRED ENTITIES AND OBJECTS==
    '''X Axis'''          ''Checked''
1)  '''FUNC_ROT_BUTTON''' (''This is a brush-model entity.'')
    '''Y Axis'''          ''Checked''
:a) Create a new texture brush on your map.
    '''Use Activates'''  ''Checked''
: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''


3) Create a new prop_dynamic entity and browse/set its world model/skin as model:  
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''


  Recommended model:  ''firetrap_button01a.mdl'' (The Button)
==SET INPUTS/OUTPUTS (I/O)==
1) Set the following output trigger(s) in the (''Func_for_Button'') brush's I/O.


4) Create a new prop_static entity and browse/set its world model/skin as model:  
[[Image:Bttn Func IO.png]]


  Recommended model:  ''firetrap_buttonpad.mdl''  (The Button Pad)
== ALIGN AND GROUP THE OBJECTS ==


== SET OBJECTS' PARENT/CHILD RELATIONSHIP ==
1) Place the (''Func_for_Button'') brush over the (''Bttn'') entity, making sure that (''Bttn'') is completely enclosed by (''Func_for_Button'').  
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:
2) Expand the size of the (''Func_for_Button'') to allow enough accessible interaction between the brush and the player.


  (func_rot_button)           Name =  MyButtonRotator
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.
  (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:
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.


  (prop_dynamic) ''button''     Parent = MyButtonRotator
5) '''Group''' the objects.  (You can also save the finished group as a pre-fab)


== SET OUTPUTS ==
==NOTES==
 
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.


See also:  [[User:ThepaperDog | WORKING WITH AXIS, ORIENTATION AND ORIGIN]]


Updates pending: (button, rotating button, switch, switch pad, red button)  
Updates pending: (button, rotating button, switch, switch pad, red button)  


--The PaperDog 03:34, 18 February 2009 (UTC)--
--The PaperDog 20:16, 8 March 2009 (UTC)


Retrieved from "http://developer.valvesoftware.com/wiki/User_talk:ThePaperDog"
Retrieved from "http://developer.valvesoftware.com/wiki/User_talk:ThePaperDog"

Revision as of 13:16, 8 March 2009

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

Updates pending: (button, rotating button, switch, switch pad, red button)

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

Retrieved from "http://developer.valvesoftware.com/wiki/User_talk:ThePaperDog"