System.Nullable<Transform> GetAttachment( string name, bool worldSpace )

robot_2Generated
code_blocksInput

Description

The GetAttachment method retrieves the transform of a specified attachment point on a skinned model. This method is part of the SkinnedModelRenderer class, which is responsible for rendering skinned models with bones and animations in the world.

Usage

To use the GetAttachment method, you need to provide the name of the attachment point you want to retrieve and specify whether you want the transform in world space or local space.

If the attachment point is found, the method returns a Transform object representing the position, rotation, and scale of the attachment. If the attachment point is not found, the method returns null.

Example

// Example usage of GetAttachment method
SkinnedModelRenderer modelRenderer = new SkinnedModelRenderer();
string attachmentName = "hand_r";
bool worldSpace = true;

Transform? attachmentTransform = modelRenderer.GetAttachment(attachmentName, worldSpace);

if (attachmentTransform.HasValue)
{
    Transform transform = attachmentTransform.Value;
    // Use the transform for further operations
}
else
{
    // Handle the case where the attachment is not found
}