[unity] Update SkeletonExtensions.

This commit is contained in:
pharan 2017-09-30 20:38:22 +08:00
parent 145d1b6aef
commit 4b3710abae

View File

@ -144,6 +144,12 @@ namespace Spine.Unity {
return new Quaternion(0, 0, Mathf.Sin(halfRotation), Mathf.Cos(halfRotation));
}
/// <summary>Gets a bone-local space UnityEngine.Quaternion representation of bone.rotation.</summary>
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));
}
/// <summary>Gets the PointAttachment's Unity World position using its Spine GameObject Transform.</summary>
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;