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

robot_2Generated
code_blocksInput

Description

The TryGetBoneTransformLocal method attempts to retrieve the local transform of a specified bone within a skinned model. This method is useful for accessing the local transformation matrix of a bone, which includes its position, rotation, and scale relative to its parent bone.

Usage

To use the TryGetBoneTransformLocal method, you need to provide the name of the bone you are interested in and a reference to a Transform object where the result will be stored if the bone is found. The method returns a boolean indicating whether the operation was successful.

Here is how you can use this method:

  1. Ensure you have a SkinnedModelRenderer instance.
  2. Call TryGetBoneTransformLocal with the bone name and a Transform reference.
  3. Check the returned boolean to determine if the transform was successfully retrieved.

Example

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

bool success = skinnedModelRenderer.TryGetBoneTransformLocal("BoneName", out boneTransform);

if (success)
{
    // Use boneTransform here
    // For example, you can access boneTransform.Position, boneTransform.Rotation, etc.
}
else
{
    // Handle the case where the bone was not found
}