Inverse kinematics¶
The structures that let the engine plant a foot on uneven ground rather than letting it hover, and keep a hand on a weapon that has moved.
studiohdr_t.ikchainindexreaches themstudioikchain_tlist – the chains a model has, typically one per leg. Each chain is a short list ofmstudioiklink_t, naming the bones it runs through and the direction the knee bends.The rules live on the animations, not the chains, and not the sequences.
mstudioikrule_thangs offmstudioanimdesc_t.ikruleindex, and says what a chain should do during that animation.mstudioseqdesc_t.numikrulesis a count with no array behind it. 21.85% of animdescs in Team Fortress 2 carry at least one rule, so this is a common path rather than an exotic one.Error terms come in two forms.
ikerrorindexreaches uncompressedmstudioikerror_t;compressedikerrorindexreaches amstudiocompressedikerror_t, which stores six scales and six offsets into the same animvalue streams the bone animation uses. Only one is present.pError is frame biased. The accessor indexes
(i - iStart), noti: a rule that begins partway through an animation stores only the frames it covers.
mstudiolocalhierarchy_tis the neighbouring idea: it lets an animation temporarily reparent a bone – a hand to a steering wheel for the duration of a sequence – rather than solving for it.
- struct valvemdl.structs.ik.mstudiolocalhierarchy_t¶
- struct valvemdl.structs.ik.mstudioikrule_t¶
-
-
type
(<parsed from long>¶int) one of the IK constants; IK_SELF, IK_WORLD, IK_GROUND, IK_RELEASE, IK_ATTACHMENT, IK_UNLATCH
-
chain
(<parsed from long>¶int) which
mstudioikchain_tthis rule drives
-
q
(¶Quaternion)
-
compressedikerrorindex
(<parsed from long>¶int) offset to a
mstudiocompressedikerror_t
-
ikerrorindex
(<parsed from long>¶int) offset to an array of
mstudioikerror_t
-
type
- struct valvemdl.structs.ik.mstudiocompressedikerror_t¶
- struct valvemdl.structs.ik.mstudioikerror_t¶
-
-
q
(¶Quaternion)
-
q
- struct valvemdl.structs.ik.mstudioikchain_t¶
-
-
linkindex
(<parsed from long>¶int) offset to an array of
mstudioiklink_t
-
linkindex