فهرست منبع

Merge branch 'master' into 3.6-beta

badlogic 8 سال پیش
والد
کامیت
1f47f45574
1فایلهای تغییر یافته به همراه10 افزوده شده و 0 حذف شده
  1. 10 0
      spine-unity/Assets/spine-unity/SkeletonUtility/SkeletonUtility.cs

+ 10 - 0
spine-unity/Assets/spine-unity/SkeletonUtility/SkeletonUtility.cs

@@ -75,6 +75,16 @@ namespace Spine.Unity {
 
 		public static PolygonCollider2D AddBoundingBoxAsComponent (BoundingBoxAttachment box, Slot slot, GameObject gameObject, bool isTrigger = true) {
 			if (box == null) return null;
+
+			if (slot.bone != slot.Skeleton.RootBone) {
+				var rb = gameObject.GetComponent<Rigidbody2D>();
+				if (rb == null) {
+					rb = gameObject.AddComponent<Rigidbody2D>();
+					rb.isKinematic = true;
+					rb.gravityScale = 0;
+				}
+			}
+
 			var collider = gameObject.AddComponent<PolygonCollider2D>();
 			collider.isTrigger = isTrigger;
 			SetColliderPointsLocal(collider, slot, box);