Revision Difference
Structures/BoneBindPose#568352
<structure>
<realm>Shared</realm>
<description>
A <page>table</page> structure representing a single bone's orientation when its mesh is in its baseline (or "bind") pose before any animation is played.
This structure does not contain the bone ID for the bone it represents and instead relies on the structure's index within the <page>table</page> returned by <page>util.GetModelMeshes</page> to identify the bone it corresponds to.
</description>⤶
⤶
⤶
**Example:** Gets every bone's bind pose in model space, and relative to its parent bone (the form an animation sets a bone in).⤶
```lua⤶
local _, bindPoses = util.GetModelMeshes( "models/player/kleiner.mdl" )⤶
⤶
for boneId = 0, #bindPoses do⤶
local bindPose = bindPoses[ boneId ]⤶
⤶
-- The bone's position and rotation in model space⤶
local boneToModel = bindPose.matrix:GetInverseTR()⤶
⤶
-- The same relative to its parent: the parent's matrix already goes from model space into the parent's space⤶
local parentBindPose = bindPoses[ bindPose.parent ]⤶
local boneToParent = parentBindPose and parentBindPose.matrix * boneToModel or boneToModel⤶
⤶
print( boneId, boneToModel:GetTranslation(), boneToParent:GetTranslation() )⤶
end⤶
```⤶
```⤶
0 -0.000005 -0.533615 38.566917 -0.000005 -0.533615 38.566917⤶
1 -0.000000 2.448287 41.912045 0.000005 3.345128 -2.981901⤶
2 0.000001 2.794612 45.915421 4.018327 -0.000001 -0.000000⤶
3 ...⤶
```⤶
</description>⤶
<fields>
<item name="parent" type="number">
The bone ID of this bone's parent bone.
</item>
<item name="matrix" type="VMatrix">
A <page>VMatrix</page> containing this bone's position and rotation in local space relative to the model's origin.
The inverse of this bone's bind pose transform: it converts a position from model space into this bone's local space (Source's `poseToBone`). Use `matrix:GetInverseTR()` to get the bone's position and rotation in model space.
</item>
</fields>
</structure>
Garry's Mod
Rust
Steamworks
Wiki Help