diff --git a/spine-unity/Assets/spine-unity/SkeletonExtensions.cs b/spine-unity/Assets/spine-unity/SkeletonExtensions.cs index e178907a0..e81435733 100644 --- a/spine-unity/Assets/spine-unity/SkeletonExtensions.cs +++ b/spine-unity/Assets/spine-unity/SkeletonExtensions.cs @@ -144,6 +144,12 @@ namespace Spine.Unity { return new Quaternion(0, 0, Mathf.Sin(halfRotation), Mathf.Cos(halfRotation)); } + /// Gets a bone-local space UnityEngine.Quaternion representation of bone.rotation. + public static Quaternion GetLocalQuaternion (this Bone bone) { + var halfRotation = bone.rotation * Mathf.Deg2Rad * 0.5f; + return new Quaternion(0, 0, Mathf.Sin(halfRotation), Mathf.Cos(halfRotation)); + } + /// Gets the PointAttachment's Unity World position using its Spine GameObject Transform. public static Vector3 GetWorldPosition (this PointAttachment attachment, Slot slot, Transform spineGameObjectTransform) { Vector3 skeletonSpacePosition; @@ -288,6 +294,10 @@ namespace Spine { return va.bones != null && va.bones.Length > 0; } + public static bool IsRenderable (this Attachment a) { + return a is RegionAttachment || a is MeshAttachment; + } + #region Transform Modes public static bool InheritsRotation (this TransformMode mode) { const int RotationBit = 0;