bool TryGetBoneTransformLocal( string boneName, Transform& tx )
bool TryGetBoneTransformLocal( Sandbox.BoneCollection/Bone& bone, Transform& tx )

book_4_sparkGenerated
code_blocksInput

Description

Attempts to retrieve the local transform of a specified bone within a skinned model. This method is useful for accessing the bone's transform relative to its parent, rather than in world space.

Usage

To use this method, provide the name of the bone you wish to access and an uninitialized Transform variable to store the result. The method will return true if the bone is found and the transform is successfully retrieved, otherwise it will return false.

Example

// Example usage of TryGetBoneTransformLocal
SkinnedModelRenderer renderer = new SkinnedModelRenderer();
Transform boneTransform;

if (renderer.TryGetBoneTransformLocal("arm", out boneTransform))
{
    // Successfully retrieved the local transform of the 'arm' bone
    // You can now use boneTransform to manipulate or inspect the bone's local position, rotation, etc.
}
else
{
    // The specified bone was not found
}