You can control the rotation of an attachment by adjusting its properties directly. When creating or modifying an attachment, you can set its rotation independently of the bone it's attached to.
For RegionAttachment:
var slot = skeleton.FindSlot("slotName");
var attachment = slot.Attachment as RegionAttachment;
if (attachment != null) {
attachment.Rotation = desiredRotationInDegrees;
attachment.UpdateRegion();
}
When creating a new attachment:
var slot = skeleton.FindSlot("slotName");
var newAttachment = new RegionAttachment(attachmentName, attachmentName);
newAttachment.Region = region;
newAttachment.Width = region.width;
newAttachment.Height = region.height;
newAttachment.Rotation = desiredRotationInDegrees; // Set your desired rotation here
slot.SetAttachment(newAttachment);
The Rotation property allows you to set the attachment's rotation relative to the bone, so even if the bone is rotated, you can adjust the attachment to display at the angle you need.
Alternative approach:
If you need more control, you could also adjust the attachment's offset using the X and Y properties along with rotation to position and orient it exactly as needed:
newAttachment.X = offsetX;
newAttachment.Y = offsetY;
newAttachment.Rotation = desiredRotation;
newAttachment.ScaleX = scaleX;
newAttachment.ScaleY = scaleY;
This approach eliminates the need for placeholder transparent images and gives you full control over the attachment's transform properties.