Entity Hierarchy (parenting): Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(cortrdronl)
No edit summary
 
(74 intermediate revisions by 31 users not shown)
Line 1: Line 1:
[http://canopy.xxxy.info/ethan-theresa-video.html ethan theresa video] [http://revile.x24hr.com/mls-charleston.html mls charleston south carolina] [http://romish.portrelay.com/description/estate-michigan.html estate michigan real south west] [http://tercel.zyns.com/dollmaker.html dollmaker] [http://ewood.isasecret.com/blog/laredo-national.html laredo national bankshares] [http://pacify.x24hr.com/library/nasty-girl-clip.html nasty girl clip] [http://stage.x24hr.com/q/massage-bed.html massage bed] [http://expel.isasecret.com/coheed.html coheed] [http://drum.got-game.org/new/alex-emma-movie.html alex and emma movie] [http://romish.portrelay.com/description/tv-turns-off-by.html tv turns off by itself] [http://sighed.zyns.com/words-to-use.html words to use on a resume] [http://jewels.zyns.com/directory/clothing-wholesale.html clothing wholesale] [http://image-movie-tombstone.sitenavigate.in/ image movie tombstone] [http://drives.xxuz.com/stop-sign.html stop sign] [http://mcdowell-mountain.sugaryblog.com/ mcdowell mountain storage] [http://wincot.serveusers.com/web/toyota-4-wheel.html toyota 4 wheel drive part] [http://vagrom.ikwb.com/fiberglass-rod.html fiberglass street rod body] [http://erlook.ikwb.com/ass-ernies-house.html ass ernies house whoop] [http://feste.isasecret.com/new/student-insurance.html student insurance] [http://hoars.25u.com/blog/mount-washington.html mount washington real estate] [http://killes.zyns.com/web/photo-2007-gmc.html photo 2007 gmc yukon] [http://bodied.25u.com/arkansas-white.html arkansas white water rafting] [http://hoars.25u.com/blog/chimpanzee.html chimpanzee] [http://orange-county.mioforum.com/ orange county florida public library] [http://sided.mywww.biz/description/what-is-callback.html what is callback method] [http://bonny.portrelay.com/web/sm502.html sm502] [http://ewood.isasecret.com/blog/2-women-kissing.html 2 women kissing] [http://diadem.fartit.com/aircraft-glasair.html aircraft glasair] [http://kajol-new-movies.trustee-planet.in/ kajol new movies] [http://bosko.ikwb.com/jugs-movies.html jugs movies] [http://aem-induction-kits.voodoo-ref.com/ aem induction kits] [http://sighed.zyns.com/busen.html busen gross] [http://scoliosis.uni-nail.com/ yoga for scoliosis] [http://killes.zyns.com/web/online-news.html online news radio] [http://arise.x24hr.com/text/lesbain-videos.html lesbain videos free] [http://arise.x24hr.com/text/asian-lesbian-porn.html asian lesbian porn video] [http://arise.x24hr.com/text/emotions-destinys.html emotions destinys child video] [http://spray.ikwb.com/data/jesus.html jesus] [http://ar-dept-correction.voodoo-ref.com/ ar dept correction] [http://broth.x24hr.com/blog/asbestos.html asbestos cancer] [http://scopes.www1.biz/girls-msn-names.html girls msn names] [http://modest.serveusers.com/mare-winningham.html mare winningham] [http://broth.x24hr.com/blog/music-fundamentals.html music fundamentals] [http://vouch.mynumber.org/blog/national-weather.html national weather service center] [http://searce.isasecret.com/text/mercure-resort.html mercure resort surfers paradise queensland] [http://twinn.justdied.com/q/free-carreer.html free carreer horoscope] [http://haven.ikwb.com/resources/bed-bath-and-beyond.html bath bed beyond retailer store] [http://drives.xxuz.com/ocean-animals.html ocean animals] [http://mchammer.isasecret.com/amd-computers.html amd cheap computer] [http://saturn.sexidude.com/small/kelty-tent.html kelty tent] [http://mchammer.isasecret.com/sitemap.html website] [http://pear.x24hr.com/view/large-scale-illusion.html large scale illusion video magic] [http://all-for-you.sewenty.in/ janet jackson pleasure principle video] [http://mp3-player-with.uni-nail.com/ mp3 player with compact flash card] [http://knead.justdied.com/html/genuine-nissan-auto.html genuine nissan auto parts] [http://haven.ikwb.com/resources/home-owner-insurance.html home owner insurance] [http://pacify.x24hr.com/library/burichan.html burichan] [http://cavil.x24hr.com/web/editing-dvd-movie.html dvd movie editing software] [http://ignomy.zyns.com/first-time-gay.html first time gay experience] [http://lizard.x24hr.com/blog/holiday-flowers.html holiday flower delivery] [http://jowls.zyns.com/alcan.html alcan kitimat] [http://unmade.x24hr.com/description/jayne-kennedy.html jayne kennedy sex] [http://batch.got-game.org/evgeny-plushenko.html evgeny plushenko video] [http://palace.mynumber.org/small/where-can-i-chat.html where can i chat with someone in my hometown] [http://chaff.isasecret.com/small/online-currency.html allows converter currency online] [http://landfat.org.in/kelly-clarkson.html kelly clarkson moment like this video] [http://drum.got-game.org/new/knee-injury-videos.html knee injury videos] [http://livest.www1.biz/grannys.html granny sluts] [http://bedash.isasecret.com/landscape-art.html landscape art prints] [http://george.myftp.info/content/dinette-set.html contemporary dinette set] [http://vouch.mynumber.org/blog/to-be-or-not-to.html to be or not to be] [http://jewels.zyns.com/directory/tennis-player.html tennis player arthur ashe] [http://await.ikwb.com/library/thailand-girls.html thailand girls massage bars] [http://bonny.portrelay.com/web/illinois-spiders.html illinois spiders] [http://chaff.isasecret.com/small/galveston-cruises.html cruises out of galveston tx] [http://regard.zyns.com/small/toagosei.html toagosei] [http://pacify.x24hr.com/library/motivational.html motivational speeches from movies] [http://cavil.x24hr.com/web/kingston-movie.html kingston movie ny] [http://abc-free-gay.ferratu.in/ abc free gay daily movie clip] [http://unmade.x24hr.com/description/drysol.html drysol] [http://bosko.ikwb.com/lesbian-action.html lesbian action video] [http://bosko.ikwb.com/eat-it-weird-al.html weird al video eat it] [http://pear.x24hr.com/view/american-camera.html american camera idol karaoke video] [http://landfat.org.in/a-very-long-engagement.html a very long engagement movie reviews] [http://vagrom.ikwb.com/laminate-thumbhole.html laminate thumbhole] [http://dexter.zyns.com/reno-news-papers.html reno news papers] [http://vouch.mynumber.org/blog/ancient-cultures.html ancient cultures] [http://kata-sepai-video.sitenavigate.in/ kata sepai video] [http://kendig-movie-square.zonempower.in/ kendig movie square] [http://vagrom.ikwb.com/algae-control.html algae control in farm pond] [http://aiming.isasecret.com/library/garfish.html garfish] [http://spends.longmusic.com/directory/cheal.html cheal] [http://moveth.ygto.com/mbc-2-tv-schedule.html mbc 2 tv schedule] [http://lizard.x24hr.com/blog/lincoln-nebraska.html lincoln nebraska nissan] [http://antarctica-the.sewenty.in/ antarctica the movie japanese] [http://amoxil-875-mg.voodoo-ref.com/ amoxil 875 mg] [http://hoars.25u.com/blog/portrait-de-parents.html portrait de parents] [http://leather-skirt-gallery.sitenavigate.in/ leather skirt gallery movies milf] [http://bedash.isasecret.com/sony-ericsson.html t230 sony ericsson ringtone] [http://batch.got-game.org/ametuer-bmx-video.html ametuer bmx video] [http://penetration.mioforum.com/ intense penetration] [http://quench.justdied.com/resources/honda-pressure.html honda pressure washers] [http://weekly.longmusic.com/library/lassic-rock.html lassic rock] [http://aiming.isasecret.com/library/skater-clothing.html skater clothing for girls] [http://california-solar.uni-nail.com/ california solar power rebates] [http://batch.got-game.org/alvin-ailey-video.html alvin ailey video] [http://speculum-stories.mioforum.com/ speculum page story] [http://crare.xxxy.info/waters-consulting.html waters consulting group] [http://resum.isasecret.com/nichel-chimico.html nichel chimico] [http://calve.x24hr.com/description/seattle-space-needle.html needle picture seattle space] [http://killes.zyns.com/web/knapp.html knapp chevrolet] [http://jowls.zyns.com/isabeli-fontana.html isabeli fontana] [http://aiming.isasecret.com/library/neva.html cal neva hotel] [http://installing-hardwood.sugaryblog.com/ installing hardwood flooring] [http://ewood.isasecret.com/blog/janet-jameson.html janet jameson] [http://sighed.zyns.com/digital-cable-vs.html digital cable vs satellite] [http://await.ikwb.com/library/marysville-real.html marysville real estate investment] [http://haven.ikwb.com/resources/injury-settlement.html cash for personal injury settlement] [http://checks.fartit.com/content/media-duplication.html media duplication] [http://messe.justdied.com/sex-shows.html night sex show sunday] [http://spends.longmusic.com/directory/jin-tha-mc-battles.html jin tha mc battles] [http://allons.www1.biz/topic/mp3-music-download.html mp3 music download free] [http://tercel.zyns.com/ikon-car.html ikon car] [http://dexter.zyns.com/luxury-rental-homes.html luxury rental homes in kauai] [http://checks.fartit.com/content/greyhound-canada.html greyhound shipping canada] [http://essex.zyns.com/oak-harbor-high.html oak harbor high school alumnus] [http://searce.isasecret.com/text/spiritual-publishers.html spiritual publishers] [http://coher.isasecret.com/archery-video-clips.html archery video clips] [http://romish.portrelay.com/description/unc-game-tonight.html unc game tonight] [http://pear.x24hr.com/view/its-hard-to.html its hard to kiss the lips at night video] [http://hoars.25u.com/blog/en-language.html en language team turned] [http://romish.portrelay.com/description/location-de-voiture.html location de voiture montreal] [http://ignomy.zyns.com/mutilated-monkey.html mutilated monkey meat] [http://anime-giantess-video.sitenavigate.in/ anime giantess video] [http://lizard.x24hr.com/blog/special-air-service.html special air service] [http://scopes.www1.biz/very-old-sex.html very old sex] [http://await.ikwb.com/library/aluminum-wall.html aluminum wall louvers] [http://gnawn.isasecret.com/q/live-wire.html live wire .com] [http://diadem.fartit.com/puberty.html boy puberty] [http://vancouver-mls-listings.sugaryblog.com/ listing mls vancouver wa] [http://aiming.isasecret.com/library/infrastructure-engineering.html infrastructure engineering corporation] [http://saladdressing.mioforum.com/ saladdressing] [http://really.longmusic.com/blog/beautiful-russian.html beautiful russian bride] [http://arise.x24hr.com/text/lisa-rogers-videos.html lisa rogers videos] [http://exploitedmoms.ferratu.in/ exploitedmoms movie] [http://wincot.serveusers.com/web/yamaha-jet-skis.html yamaha jet skis] [http://feste.isasecret.com/new/consumer-report.html consumer report refrigerator rating] [http://how-to-do-a-kickflip.mioforum.com/ kickflip] [http://lizard.x24hr.com/blog/rubber-expansion.html rubber expansion joint] [http://growth.zyns.com/comments/131-ablation.html 131 ablation] [http://quench.justdied.com/resources/most-beautiful-man.html most beautiful man com] [http://saturn.sexidude.com/sitemap.html url] [http://oaken.isasecret.com/blog/topper-rack.html topper rack] [http://stage.x24hr.com/q/import-tuner-cars.html car import part tuner] [http://searce.isasecret.com/text/home-security.html home security monitoring] [http://fists.isasecret.com/pages/american-idol-4.html american idol season 4] [http://romish.portrelay.com/description/samsung-e315.html samsung e315] [http://erlook.ikwb.com/suzanne-martin.html suzanne martin phd] [http://spray.ikwb.com/data/milwaukee-condominiums.html milwaukee condominiums] [http://ewood.isasecret.com/blog/uzbekistan-ngo.html uzbekistan ngo] [http://climbs.sexidude.com/pages/a-raisin-in.html a raisin in the sun movie lesson plan] [http://climbs.sexidude.com/pages/india-sri-lanka.html india sri lanka cricket live video] [http://peguin-swing.mioforum.com/ peguin swing] [http://sacred.ygto.com/animated-funny.html animated funny stuff] [http://unmade.x24hr.com/description/alaskan-airlines.html alaskan airlines] [http://await.ikwb.com/library/jim-jones.html jim jones lyric] [http://latest-al-qaeda.ferratu.in/ latest al qaeda video] [http://bosko.ikwb.com/elton-john-music.html elton john music video] [http://blown.longmusic.com/comments/personalized.html personalized photo tag] [http://vagrom.ikwb.com/2-entry-forceable.html 2 entry forceable wwe] [http://jewels.zyns.com/directory/pica.html pica] [http://scopes.www1.biz/dvd-r.html verbatim dvd r] [http://allison-williams.libero-delirium.in/ allison williams video free] [http://stage.x24hr.com/q/privacy-shrub.html privacy shrub or tree] [http://ktm-950-adventure.zonempower.in/ ktm 950 adventure video] [http://kitten.xxuz.com/majong.html majong] [http://searce.isasecret.com/text/antoine-cythera.html antoine cythera pilgrimage watteau] [http://kitten.xxuz.com/jippii.html jippii] [http://cavil.x24hr.com/web/alpine-championship.html alpine championship sugarloaf video] [http://haven.ikwb.com/resources/ford-tractors.html ford tractors] [http://computer-part.uni-nail.com/ accessory computer part personal] [http://weekly.longmusic.com/library/hand-protection.html hand protection liquid] [http://canopy.xxxy.info/internal-sex-video.html internal sex video] [http://cavil.x24hr.com/web/live-night-saturday.html live night saturday video] [http://recks.fartit.com/styles/about-brazilian.html brazilian government] [http://idea-movie-submit.libero-delirium.in/ idea movie submit] [http://await.ikwb.com/library/asian-festival.html asian festival film international] [http://vagrom.ikwb.com/mosiac.html mosiac] [http://romish.portrelay.com/description/tracfone-class.html tracfone class action lawsuit] [http://ignomy.zyns.com/what-do-dreams-means.html crow dream it means] [http://really.longmusic.com/blog/ambien-cheap.html ambien cheap cr] [http://tercel.zyns.com/sitemap.html webmap] [http://await.ikwb.com/library/asian-cock-giant.html asian cock giant] [http://checks.fartit.com/content/popcapcom.html popcap.com book worm] [http://tercel.zyns.com/country-music.html country music guitar chords] [http://austin-movie-listing.sitenavigate.in/ austin movie listing] [http://larder.xxxy.info/lib/ring-worms.html ring worm cure] [http://sacred.ygto.com/sitemap.html website] [http://sighed.zyns.com/womens-formal-shoes.html womens formal shoes] [http://sfusd.sugaryblog.com/ lowell sfusd]
{{LanguageBar}}
An entity with a parent will duplicate its parent's motion (move with it).  An example would be parenting a [[light_dynamic]] to a lamp [[prop_physics|prop]] so the light becomes part of the lamp and moves with it. A group of objects parented together form an hierarchy and essentially become one object.


To parent two objects together, type a name for the parent object in its Name [[keyvalue]]. For the other object, set its Parent key value to that same name.
When a group of entities are ''parented'' together, they form a rigid movement hierarchy family which will move together as if all the entities were one physical object. Each child-entity will follow its parent's movement.  


Only certain entities can have parents. For example, a prop_physics cannot because it is its own physics object.  In this case, a [[prop_dynamic]] or [[prop_dynamic_override]] should be used instead.
A simple example would be parenting a [[light_dynamic]] to a lamp [[prop_physics|prop]] so the light becomes part of the lamp and moves with it.  


{{otherlang:en}}
The child-parent relationship is always defined in the [[HammerObjectPropertiesDialog|object properties]] of the child-entity. The parent-entity doesn't have any say in choosing its followers. This leads to the rather awkward use of 'parenting' as a reflexive verb throughout the documentation, eg "must be parented", "parent the child to the parent", "entities can have parents", etc.
{{otherlang:en:jp|Entity Hierarchy (parenting):jp}}
 
All entities can have parents, though many entities [[Non-FGD features|do not include it in their FGD entries]], and it may not necessarily function correctly. For example, [[prop_physics]] behave oddly when parented because they are physically simulated objects, and a [[logic_relay]] for example isn't visible or moves on its own, so parenting it would have little effect. For prop_physics, it's generally better to use a [[prop_dynamic]] or [[prop_dynamic_override]] instead or use the [[constraint|physics constraint system]].
 
{{warning | There is a limit of '''512''' entities permitted to be in a single parenting hierarchy/chain. {{todo|What happens if this limit is exceeded?}}}}
 
== Child Behavior ==
 
* The '''Offset''' is the distance (and any rotational offset) between the Child and Parent entities at the time the relationship is activated. Whilst the offset is maintained, the Child will move parallel to its parent's movements, and "orbit" the parent's origin at the offset distance when the parent rotates. Only the <code>SetParentAttachment</code> input ''changes'' the offset; it instantly "teleports" the child to the parent's attachment point and holds it there instead.
 
* '''Collision''' : Physics simulation will no longer occur for children, causing them to potentially pass through walls or other solid objects if the parent moves them there. Scripted movements such as animations or brush-based entities will still occur, so you can chain different brush entities together to form a complex moving contraption.
 
* If the Parent is '''[[Kill]]ed''', all of its current Children are also removed from the game.
 
* If a child does not define behavior for player interaction (+USE) or touching these will be '''relayed''' to the parent. This allows you to parent a [[prop_dynamic]] to a [[func_button]] and then have the player +USE the model to interact with the button, for example.
 
== Keyvalues ==
=== parentname ===
To create a child-parent relationship between two entities, set the ''child''-entity's <code>parentname</code> keyvalue to the parent-entity's '''[[targetname]]'''.
* Maintains offset.
* Additionally, an [[attachment]] point can be set by setting the value to <code>parent,attachment</code>. This can be used to have an entity follow an animated part of the model, such as the Howitzer handle in {{l4d}}. It behaves like <code>SetParentAttachmentMaintainOffset</code>.<br /> For example: <code>Howitzer_prop,Handle</code>. {{Note|This way of setting attachment is supported only for <code>parentname</code> keyvalue and not for <code>SetParent</code> input.}}
 
[[File:L4D Handle prop Following attachment.gif|thumb|The Howitzer handle, as separate prop, following the "Handle" [[$attachment]] of the Howitzer model.]]
 
=== updatechildren ===
Keyvalue available on {{ent|prop_dynamic}} [[since]] {{l4d|4}}.
If set to 1 the entity will update touches for any children that are attached to its attachment points as this prop animates. This allows SetParentAttached triggers or func_brushes to touch properly. {{confirm|Is this taken care of in src13 by other means? }}
 
== Inputs ==
=== SetParent ===
You can also [[Inputs_and_Outputs|fire]] a '''SetParent input''' at the child-entity to change its child-parent relationship.
* Use the ''targetname'' of the new parent as the input parameter to make the child follow the new parent. (can also be a special targetname such as [[targetname|!activator]].)
* If you leave the parameter blank, it has the same effect as the ''ClearParent'' input (see below).
* Maintains offset.
 
=== SetParentAttachment ===
Takes name of a specific [[attachment]] point that exists on its parent as parameter. If used on entity without a parent it prints warning to console and does nothing. <br>
Use at least a <code>0.02</code> second delay between <code>SetParent</code> and <code>SetParentAttachment</code> input, to ensure they run in the right order.
* The child entity will be teleported to the '''location and rotation''' of the attachment point.
 
Your child entity will align its location and axis with the parent models attachment location and axis. You can find out the attachment location and axis by loading the model in [[HLMV]] or by command {{ent|ent_attachments}}.<br>
The only way to change this is by either recompiling the parent model to change its attachments, or recompiling the child model to change its entire rotation.<br>
 
 
[[File:SetParentAttachment GLaDOS Example.png|500px]]<br>
A Personality core in {{portal|1}} following an [[$attachment]] of the GLaDOS model using <code>SetParentAttachment</code>.<br> As you can see, the Sphere has its axis shown in hammer, GLaDOS has her attachments axis shown in HLMV.<br>The sphere aligns its axis with the axis of GLADOS' Attachment point.
 
=== SetParentAttachmentMaintainOffset ===
Identical to <kbd>SetParentAttachment</kbd> input with a difference that the entity is not teleported to the specified attachment point.
 
=== ClearParent ===
You can also fire a <code>ClearParent</code> '''input''' at the child-entity to remove its child-parent relationship. This simply 'unparents' or 'detaches' the child-entity from its current parent, so the child is then free to move (or not) independently of its former parent.
 
=== KillHierarchy ===
If you [[Inputs_and_Outputs|fire]] a '''KillHierarchy input''' at the parent-entity, it removes the parent-entity ''and'' all of its children from the world.
* If you fire a '''Kill input''' at the parent-entity, its children will be detected and eventually also destroyed, logging a warning in the console. This happens almost immediately, but it may be possible for other logic or outputs to be executed before they're fully cleaned up.
 
== Alternatives ==
A few "alternatives" exist to the standard entity hierarchy system. They may be suitable for specific purposes or are specialized to a particular set of entities.
 
* [[Constraint|Physics Constraints]] are designed to constrain physically simulated entities like prop_physics. They can wobble, break, and do various other cool things.
* [[logic_measure_movement]] causes an entity to mimic the movements of another with room for flexibility. You could use this to move entities that cannot usually be parented, like logic entities or physics props.
* [[prop_dynamic_ornament]] takes advantage of bonemerging, the same system weapons use to attach to their owners' hands. This still uses parenting under the hood.
 
Programmers can also use <code>[[FollowEntity()]]</code> to take advantage of bonemerging without having to use prop_dynamic_ornament.


[[Category:Level Design]]
[[Category:Level Design]]
== External links ==
'''Map example .VMF (NPC_Citizen holding a small pipe) - By Madcow'''
* https://twhl.info/index.php/vault/view/5027
'''Map example .VMF and .BSP (Improved Alternative methods) - By gtamike_TSGK'''
* http://gtamike.tsgk.com/gtamike_TSGK/test_area_parent_attachments.rar
== See also ==
* [[Attachment_points_for_HL2]] - List of attachment points to parent

Latest revision as of 19:47, 28 August 2025

English (en)Esperanto (eo)日本語 (ja)Русский (ru)中文 (zh)Translate (Translate)

When a group of entities are parented together, they form a rigid movement hierarchy family which will move together as if all the entities were one physical object. Each child-entity will follow its parent's movement.

A simple example would be parenting a light_dynamic to a lamp prop so the light becomes part of the lamp and moves with it.

The child-parent relationship is always defined in the object properties of the child-entity. The parent-entity doesn't have any say in choosing its followers. This leads to the rather awkward use of 'parenting' as a reflexive verb throughout the documentation, eg "must be parented", "parent the child to the parent", "entities can have parents", etc.

All entities can have parents, though many entities do not include it in their FGD entries, and it may not necessarily function correctly. For example, prop_physics behave oddly when parented because they are physically simulated objects, and a logic_relay for example isn't visible or moves on its own, so parenting it would have little effect. For prop_physics, it's generally better to use a prop_dynamic or prop_dynamic_override instead or use the physics constraint system.

Warning.pngWarning: There is a limit of 512 entities permitted to be in a single parenting hierarchy/chain.
Todo: What happens if this limit is exceeded?

Child Behavior

  • The Offset is the distance (and any rotational offset) between the Child and Parent entities at the time the relationship is activated. Whilst the offset is maintained, the Child will move parallel to its parent's movements, and "orbit" the parent's origin at the offset distance when the parent rotates. Only the SetParentAttachment input changes the offset; it instantly "teleports" the child to the parent's attachment point and holds it there instead.
  • Collision : Physics simulation will no longer occur for children, causing them to potentially pass through walls or other solid objects if the parent moves them there. Scripted movements such as animations or brush-based entities will still occur, so you can chain different brush entities together to form a complex moving contraption.
  • If the Parent is Killed, all of its current Children are also removed from the game.
  • If a child does not define behavior for player interaction (+USE) or touching these will be relayed to the parent. This allows you to parent a prop_dynamic to a func_button and then have the player +USE the model to interact with the button, for example.

Keyvalues

parentname

To create a child-parent relationship between two entities, set the child-entity's parentname keyvalue to the parent-entity's targetname.

  • Maintains offset.
  • Additionally, an attachment point can be set by setting the value to parent,attachment. This can be used to have an entity follow an animated part of the model, such as the Howitzer handle in Left 4 Dead. It behaves like SetParentAttachmentMaintainOffset.
    For example: Howitzer_prop,Handle.
    Note.pngNote:This way of setting attachment is supported only for parentname keyvalue and not for SetParent input.
The Howitzer handle, as separate prop, following the "Handle" $attachment of the Howitzer model.

updatechildren

Keyvalue available on prop_dynamic since Left 4 Dead Left 4 Dead.

If set to 1 the entity will update touches for any children that are attached to its attachment points as this prop animates. This allows SetParentAttached triggers or func_brushes to touch properly.

Confirm:Is this taken care of in src13 by other means?

Inputs

SetParent

You can also fire a SetParent input at the child-entity to change its child-parent relationship.

  • Use the targetname of the new parent as the input parameter to make the child follow the new parent. (can also be a special targetname such as !activator.)
  • If you leave the parameter blank, it has the same effect as the ClearParent input (see below).
  • Maintains offset.

SetParentAttachment

Takes name of a specific attachment point that exists on its parent as parameter. If used on entity without a parent it prints warning to console and does nothing.
Use at least a 0.02 second delay between SetParent and SetParentAttachment input, to ensure they run in the right order.

  • The child entity will be teleported to the location and rotation of the attachment point.

Your child entity will align its location and axis with the parent models attachment location and axis. You can find out the attachment location and axis by loading the model in HLMV or by command ent_attachments.
The only way to change this is by either recompiling the parent model to change its attachments, or recompiling the child model to change its entire rotation.


SetParentAttachment GLaDOS Example.png
A Personality core in Portal following an $attachment of the GLaDOS model using SetParentAttachment.
As you can see, the Sphere has its axis shown in hammer, GLaDOS has her attachments axis shown in HLMV.
The sphere aligns its axis with the axis of GLADOS' Attachment point.

SetParentAttachmentMaintainOffset

Identical to SetParentAttachment input with a difference that the entity is not teleported to the specified attachment point.

ClearParent

You can also fire a ClearParent input at the child-entity to remove its child-parent relationship. This simply 'unparents' or 'detaches' the child-entity from its current parent, so the child is then free to move (or not) independently of its former parent.

KillHierarchy

If you fire a KillHierarchy input at the parent-entity, it removes the parent-entity and all of its children from the world.

  • If you fire a Kill input at the parent-entity, its children will be detected and eventually also destroyed, logging a warning in the console. This happens almost immediately, but it may be possible for other logic or outputs to be executed before they're fully cleaned up.

Alternatives

A few "alternatives" exist to the standard entity hierarchy system. They may be suitable for specific purposes or are specialized to a particular set of entities.

  • Physics Constraints are designed to constrain physically simulated entities like prop_physics. They can wobble, break, and do various other cool things.
  • logic_measure_movement causes an entity to mimic the movements of another with room for flexibility. You could use this to move entities that cannot usually be parented, like logic entities or physics props.
  • prop_dynamic_ornament takes advantage of bonemerging, the same system weapons use to attach to their owners' hands. This still uses parenting under the hood.

Programmers can also use FollowEntity() to take advantage of bonemerging without having to use prop_dynamic_ornament.

External links

Map example .VMF (NPC_Citizen holding a small pipe) - By Madcow

Map example .VMF and .BSP (Improved Alternative methods) - By gtamike_TSGK

See also