This article's documentation is for anything that uses the Source engine. Click here for more information.

$attachment: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(cleanup - please check diff to ensure accuracy)
(Removing deprecated Category)
 
(15 intermediate revisions by 10 users not shown)
Line 1: Line 1:
<!--
{{LanguageBar}}
Attachment points are now named based instead of fixed indexed based. They also can be defined in absolute coordinates instead of being bone relative. If defined as "rigid", the bone they're attached won't be assumed to animate and may be optimized out, in which case they'll reattach themselves to the first available parent bone. The <code>"rotate"</code> option will change the orientation of the attachment point, in place, relative its parent joint.
{{tabsBar|main=gs|base=$attachment}}
-->
{{this is a|QC command|name=$attachment}} It defines attachments on a model. Attachments are identified by their name, and can be either relative to the model's origin or [[parent]]ed to a [[bone]].
[[Attachment point]]s are now name-based instead of fixed-index-based.
* Each attachment point's position and orientation can be defined relative to the model's origin <!--or Entity's WorldPosition / placementOrigin ?-->(<code>"absolute"</code>) ''or'' a named [[bone]]. The <code>"rotate"</code> option will change the orientation of the attachment point relative its parent [[joint]].
* If <code>"rigid"</code> is set, StudioMDL assumes the attached-to bone does not animate and may optimize it out, in which case this bone's attachments will reattach themselves to the first available parent bone.


* See [[Attachments]].
See also [[Attachments]].


== Syntax ==
== Syntax ==


  $attachment (name) (bone name) (X) (Y) (Z) ["absolute"] ["rigid"] ["rotate" pitch yaw roll]
  $attachment <[[string]]|name> <string|parent bone> <[[Vector]]|offset> [absolute] [rigid] [rotate <[[angle]]|orientation>]


== Example ==
The optional commands are:


; <code>absolute</code>
: Parented to the model's origin. The offset is still relative to the given parent bone, however!
; <code>rigid</code>
: Declares that the bone this attachment is parented to will not move, allowing Studiomdl delete that bone. The attachment will be re-parented to the next bone in the hierarchy. Useful for precise attachment placement without keeping useless bones.
; <code>rotate</code>
: Rotates the attachment, in degrees, relative to its parent bone / the origin.
: {{todo|There is some weirdness in how the value is interpreted by Studiomdl.}}
; <code>world_align</code>
: flag the attachment as should align to world and not to it own root. {{todo|this need more test.}}
; <code>x_and_z_axes</code>
: alike <code>rotate</code> but only Y axis remain at default value.
: {{todo|Need test. Why this exists? looks useless}}
== Examples ==
Relative to bone:
  $attachment "anim_attachment_RH" "ValveBiped.Anim_Attachment_RH" -0.00 -0.00 0.00 rotate -90.00 -90.00 0.00
  $attachment "anim_attachment_RH" "ValveBiped.Anim_Attachment_RH" -0.00 -0.00 0.00 rotate -90.00 -90.00 0.00


[[Category:QC Commands|attachment]]__NOTOC__
Relative to origin (no bone name required):
$attachment "nozzle" "" 0 4.8 0 absolute

Latest revision as of 21:06, 16 July 2025

English (en)한국어 (ko)Translate (Translate)

$attachment is a QC command available in all Source Source games. It defines attachments on a model. Attachments are identified by their name, and can be either relative to the model's origin or parented to a bone.

See also Attachments.

Syntax

$attachment <string|name> <string|parent bone> <Vector|offset> [absolute] [rigid] [rotate <angle|orientation>]

The optional commands are:

absolute
Parented to the model's origin. The offset is still relative to the given parent bone, however!
rigid
Declares that the bone this attachment is parented to will not move, allowing Studiomdl delete that bone. The attachment will be re-parented to the next bone in the hierarchy. Useful for precise attachment placement without keeping useless bones.
rotate
Rotates the attachment, in degrees, relative to its parent bone / the origin.
Todo: There is some weirdness in how the value is interpreted by Studiomdl.
world_align
flag the attachment as should align to world and not to it own root.
Todo: this need more test.
x_and_z_axes
alike rotate but only Y axis remain at default value.
Todo: Need test. Why this exists? looks useless

Examples

Relative to bone:

$attachment "anim_attachment_RH" "ValveBiped.Anim_Attachment_RH" -0.00 -0.00 0.00 rotate -90.00 -90.00 0.00

Relative to origin (no bone name required):

$attachment "nozzle" "" 0 4.8 0 absolute