Suspended Object Trap: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (polish and grammar/spelling)
(Improved article. (Mostly templated it.))
Line 1: Line 1:
[[Category:Level Design Tutorials]]
====Introduction====
====Introduction====
[[Image:Falling_object.jpg|frame| An example of what this tutorial will accomplish]]
[[Image:Falling_object.jpg|frame| An example of what this tutorial will accomplish.]]
This tutorial explains the process of creating a trap consisting of a heavy object suspended by a dynamic rope which can then be triggered to fall with devastating effect. This is an advanced tutorial covering entity creation, parenting, I/O configuration, keyframe editing, and flag manipulation. Overall completion time is estimated at fourty-five minutes to one hour.
This tutorial explains the process of creating a trap consisting of a heavy object suspended by a dynamic rope which can then be triggered to fall with devastating effect. This is an advanced tutorial covering entity creation, parenting, I/O configuration, keyframe editing, and flag manipulation. Overall completion time is estimated at 45 minutes to 1 hour.


The Source Hammer editor does not allow a user to directly attach an object to a rope. However, there is a workaround. The basic idea involves parenting the end of a rope to a secondary entity. This secondary entity is then used in conjunction with a few physics entities that measure the movement of the secondary entity and translate its movements back to the rope. We'll also be creating a trigger that will break the rope when it gets damaged causing the previously suspended object to crash down! Sounds complicated but don't worry, it'll make sense once it's done. Let's get started!
The Source Hammer editor does not allow a user to directly attach an object to a rope. However, there is a workaround. The basic idea involves parenting the end of a rope to a secondary entity. This secondary entity is then used in conjunction with a few physics entities that measure the movement of the secondary entity and translate its movements back to the rope. We'll also be creating a trigger that will break the rope when it gets damaged causing the previously suspended object to crash down! Sounds complicated but don't worry, it'll make sense once it's done. Let's get started!


====Entity Creation====
====Entity Creation====
*Create the following entities and brushes:
Create the following entities:
**[[move_rope]]
*A [[move_rope]],
**[[keyframe_rope]]
*a [[keyframe_rope]],
**[[phys_lengthconstraint]]
*a [[phys_lengthconstraint]],
**[[env_spark]]
*a [[env_spark]],
**[[prop_physics_override]] or [[func_physbox]]
*a [[prop_physics_override]] ''or'' a [[func_physbox]],
**[[logic_measure_movement]]
*a [[logic_measure_movement]],
**a [[brush]] with the same or as-near-as-possible dimensions of the [[prop_physics_override]] or [[func_physbox]]
*a [[brush]] with the same or as-near-as-possible dimensions of the [[prop_physics_override]] / [[func_physbox]], tied ''(Ctrl+T)'' to a [[func_button]] entity.


====Entity Placement====
====Entity Placement====
*Place the following entities or brushes:
Place the following entities or brushes:
**Place the [[move_rope]] to where you'd like to anchor the rope.  
*Place the [[move_rope]] to where you'd like to anchor the rope.  
**Place the [[prop_physics_override]] or [[func_physbox]] to where you'd like the object to hang from.
*Place the [[prop_physics_override]] / [[func_physbox]] to where you'd like the object to hang from.
***This tutorial will be using a prop instead of a physbox, but both can be used.  
**This tutorial will be using a prop instead of a physbox, but both can be used.  
**Place the [[keyframe_rope]] to where you'd like to anchor the rope to the [[prop_physics_override]] or [[func_physbox]].
*Place the [[keyframe_rope]] to where you'd like to anchor the rope to the [[prop_physics_override]] or [[func_physbox]].
***Hint: Just inside the surface of the prop or brush works best.
**Hint: Just inside the surface of the prop or brush works best.
***Remember your physics: once in game, the center of gravity of the prop and the anchor point will interact and your prop will reach a balance point accordingly.  
**Remember your physics: once in game, the center of gravity of the prop and the anchor point will interact and your prop will reach a balance point accordingly.  
**Place the [[phys_lengthconstraint]] in the exact same location of the [[keyframe_rope]] and drag the lengthconstraint's small white circle to the center of the [[move_rope]].
*Place the [[phys_lengthconstraint]] in the exact same location of the [[keyframe_rope]] and drag the lengthconstraint's small white circle to the center of the [[move_rope]].
**Place the [[env_spark]] in the exact same location of the [[keyframe_rope]].
*Place the [[env_spark]] in the exact same location of the [[keyframe_rope]].
**Place the [[logic_measure_movement]] off to the side for easy access.  
*Place the [[logic_measure_movement]] off to the side for easy access.  
**Place the [[brush]] in the same location of the [[prop_physics_override]] or [[func_physbox]].  
*Place the [[brush]] in the same location as the [[prop_physics_override]] / [[func_physbox]].
 


====Entity Properties Configuration====
====Entity Properties Configuration====
=====Naming:=====
=====Naming=====
Naming your entities is arbitrary- you can chose what names you want. For the purposes of this tutorial the nomenclature is:
Naming your entities is arbitrary - you can choose what names you want. For the purposes of this tutorial the nomenclature is:
*[[move_rope]] : '''dynamic01_move_rope'''
*[[move_rope]] : ''dynamic01_move_rope''
*[[keyframe_rope]] : '''dynamic01_keyframe_rope'''
*[[keyframe_rope]] : ''dynamic01_keyframe_rope''
*[[phys_lengthconstraint]] : '''dynamic01_phys_lengthconstraint'''
*[[phys_lengthconstraint]] : ''dynamic01_phys_lengthconstraint''
*[[env_spark]] : '''dynamic01_env_spark'''
*[[env_spark]] : ''dynamic01_env_spark''
*[[prop_physics_override]] or [[func_physbox]] : '''dynamic01_prop_phyics_override'''
*[[prop_physics_override]] / [[func_physbox]] : ''dynamic01_prop_physics_override''
*[[logic_measure_movement]] : '''dynamic01_logic_measuremovement'''
*[[logic_measure_movement]] : ''dynamic01_logic_measuremovement''
* the [[brush]] :
*[[func_button]] : ''dynamic01_func_button''
**'''Tie''', ''(Ctrl+T)'' the brush to a '''''func_button''''' entity.
**set the '''Name''' keyvalue to : '''dynamic01_func_button'''


As you can see, each entity has the prefix dynamicXX and a descriptive suffix. This is a useful naming system when you have several dynamic systems and need to keep them separate.
As you can see, each entity has the prefix ''dynamicXX'', followed by a descriptive suffix. This is a useful naming system when you have several dynamic systems and need to keep them separate.


=====Key Values for Rope Workaround:=====
=====Keyvalues for Rope Workaround=====
Here comes the tricky part where most errors are made.  
Here comes the tricky part where most errors are made.  
*set the '''dynamic01_move_rope''''s '''''Next KeyFrame''''' to ''dynamic01_keyframe_rope''
Set the keyvalues of the entities like this:
*set the '''dynamic01_move_rope''''s '''''Slack''''' to ''0''
 
*set the '''dynamic01_keyframe_rope''''s '''''Slack''''' to ''0''
 
*set the '''dynamic01_env_spark''''s parent to ''dynamic01_prop_phyics_override''
{{entity-kvalue-start|[[move_rope]]}}
*set the '''dynamic01_phys_lengthconstraint''' '''''Entity1''''' to ''dynamic01_prop_phyics_override''
{{entity-kvalue|Name|dynamic01_move_rope|The name of the move_rope entity in this tutorial.}}
*set the following values of the '''dynamic01_logic_measuremovement''' to:
{{entity-kvalue|Next KeyFrame|dynamic01_keyframe_rope|}}
**'''''Entity to Measure''''' to ''dynamic01_env_spark''
{{entity-kvalue|Slack|0|No slack.}}
**'''''Measure Reference''''' to ''dynamic01_move_rope''
{{entity-kvalue-end}}
**'''''Entity to Move''''' to ''dynamic01_keyframe_rope''
 
**'''''Movement Reference''''' to ''dynamic01_move_rope''
 
{{entity-kvalue-start|[[keyframe_rope]]}}
{{entity-kvalue|Name|dynamic01_keyframe_rope|The name of the keyframe_rope entity in this tutorial.}}
{{entity-kvalue|Slack|0|No slack here either.}}
{{entity-kvalue-end}}
 
 
{{entity-kvalue-start|[[env_spark]]}}
{{entity-kvalue|Name|dynamic01_env_spark|The name of the env_spark entity in this tutorial.}}
{{entity-kvalue|Parent|dynamic01_prop_physics_override|Tie the spark effect to the prop_physics_override entity.}}
{{entity-kvalue-end}}
 
 
{{entity-kvalue-start|[[phys_lengthconstraint]]}}
{{entity-kvalue|Name|dynamic01_phys_lengthconstraint|The name of the phys_lengthconstraint entity in this tutorial.}}
{{entity-kvalue|Entity1|dynamic01_prop_physics_override|Tie the lengthconstraint to the prop_physics_override entity too.}}
{{entity-kvalue-end}}
 
 
{{entity-kvalue-start|[[logic_measure_movement]]}}
{{entity-kvalue|Name|dynamic01_logic_measuremovement|The name of the logic_measure_movement entity in this tutorial.}}
{{entity-kvalue|Entity to Measure|dynamic01_env_spark|}}
{{entity-kvalue|Measure Reference|dynamic01_move_rope|}}
{{entity-kvalue|Entity to Move|dynamic01_keyframe_rope|}}
{{entity-kvalue|Movement Reference|dynamic01_move_rope|}}
{{entity-kvalue-end}}
 
 


=====Trap Trigger Creation=====
=====Trap Trigger Creation=====
Select the ''dynamic01_func_button'' entity and:
 
*set the '''''Parent''''' to ''dynamic01_prop_phyics_override''
Time to change the func_button. First change its keyvalues like this:
*set the '''''Disable Receiving Shadows''''' to ''Yes''
 
*set the '''''Move Direction (Pitch Yaw Roll)''''' to ''0 0 0''
{{entity-kvalue-start|[[func_button]]}}
*set the '''''Speed''''' to ''0''
{{entity-kvalue|Name|dynamic01_func_button|The name of the func_button entity in this tutorial.}}
*set the '''''Lip''''' to ''0''
{{entity-kvalue|Parent|dynamic01_prop_physics_override'|Tie this entity to the prop_physics_override.}}
*configure the '''Flags''' tab like in the image below:
{{entity-kvalue|Disable Receiving Shadows|Yes|}}
:::::[[Image:Trap_trigger_flag_config.jpg]]
{{entity-kvalue|Move Direction (Pitch Yaw Roll)|0 0 0|}}
*configure the '''Outputs''' tab like in the image below:
{{entity-kvalue|Speed|0|}}
:::::[[Image:Trap_trigger_output_config.jpg]]
{{entity-kvalue|Lip|0|}}
{{entity-kvalue-end}}
 
 
Now change its flags like this:
 
{{entity-flag-start}}
{{entity-flag|Don't move|off|}}
{{entity-flag|Toggle|off|}}
{{entity-flag|Touch Activates|off|}}
{{entity-flag|Damage Activates|on|}}
{{entity-flag|Use Activates|off|}}
{{entity-flag|Starts locked|off|}}
{{entity-flag|Sparks|off|}}
{{entity-flag-end}}
 
 
...and finally give it the following outputs:
{{entity-output-start}}
{{entity-output||OnDamaged|dynamic05_logic_measure_movement|Disable||0.00|No|}}
{{entity-output||OnDamaged|dynamic05_keyframe_rope1|Break||0.00|No|}}
{{entity-output||OnDamaged|dynamic05_phys_lengthconstraint|Break||0.00|No|}}
{{entity-output||OnDamaged|dynamic05_env_spark|Kill||0.00|No|}}
{{entity-output||OnDamaged|dynamic05_func_button|Kill||0.00|No|}}
{{entity-output-end}}
 
 
[[Category:Level Design Tutorials]]

Revision as of 10:46, 12 September 2006

Introduction

An example of what this tutorial will accomplish.

This tutorial explains the process of creating a trap consisting of a heavy object suspended by a dynamic rope which can then be triggered to fall with devastating effect. This is an advanced tutorial covering entity creation, parenting, I/O configuration, keyframe editing, and flag manipulation. Overall completion time is estimated at 45 minutes to 1 hour.

The Source Hammer editor does not allow a user to directly attach an object to a rope. However, there is a workaround. The basic idea involves parenting the end of a rope to a secondary entity. This secondary entity is then used in conjunction with a few physics entities that measure the movement of the secondary entity and translate its movements back to the rope. We'll also be creating a trigger that will break the rope when it gets damaged causing the previously suspended object to crash down! Sounds complicated but don't worry, it'll make sense once it's done. Let's get started!

Entity Creation

Create the following entities:

Entity Placement

Place the following entities or brushes:


Entity Properties Configuration

Naming

Naming your entities is arbitrary - you can choose what names you want. For the purposes of this tutorial the nomenclature is:

As you can see, each entity has the prefix dynamicXX, followed by a descriptive suffix. This is a useful naming system when you have several dynamic systems and need to keep them separate.

Keyvalues for Rope Workaround

Here comes the tricky part where most errors are made. Set the keyvalues of the entities like this:


Class: move_rope
Keyvalues Comments
Name dynamic01_move_rope The name of the move_rope entity in this tutorial.
Next KeyFrame dynamic01_keyframe_rope
Slack 0 No slack.


Class: keyframe_rope
Keyvalues Comments
Name dynamic01_keyframe_rope The name of the keyframe_rope entity in this tutorial.
Slack 0 No slack here either.


Class: env_spark
Keyvalues Comments
Name dynamic01_env_spark The name of the env_spark entity in this tutorial.
Parent dynamic01_prop_physics_override Tie the spark effect to the prop_physics_override entity.


Class: phys_lengthconstraint
Keyvalues Comments
Name dynamic01_phys_lengthconstraint The name of the phys_lengthconstraint entity in this tutorial.
Entity1 dynamic01_prop_physics_override Tie the lengthconstraint to the prop_physics_override entity too.


Class: logic_measure_movement
Keyvalues Comments
Name dynamic01_logic_measuremovement The name of the logic_measure_movement entity in this tutorial.
Entity to Measure dynamic01_env_spark
Measure Reference dynamic01_move_rope
Entity to Move dynamic01_keyframe_rope
Movement Reference dynamic01_move_rope


Trap Trigger Creation

Time to change the func_button. First change its keyvalues like this:

Class: func_button
Keyvalues Comments
Name dynamic01_func_button The name of the func_button entity in this tutorial.
Parent dynamic01_prop_physics_override' Tie this entity to the prop_physics_override.
Disable Receiving Shadows Yes
Move Direction (Pitch Yaw Roll) 0 0 0
Speed 0
Lip 0


Now change its flags like this:

Flag
Checkbox-off.png Don't move
Checkbox-off.png Toggle
Checkbox-off.png Touch Activates
Checkbox-on.png Damage Activates
Checkbox-off.png Use Activates
Checkbox-off.png Starts locked
Checkbox-off.png Sparks


...and finally give it the following outputs:

My output Target entity Target input Parameter Delay Only once Comments
Entity-output-icon.png OnDamaged dynamic05_logic_measure_movement Disable 0.00 No
Entity-output-icon.png OnDamaged dynamic05_keyframe_rope1 Break 0.00 No
Entity-output-icon.png OnDamaged dynamic05_phys_lengthconstraint Break 0.00 No
Entity-output-icon.png OnDamaged dynamic05_env_spark Kill 0.00 No
Entity-output-icon.png OnDamaged dynamic05_func_button Kill 0.00 No