Эх сурвалжийг харах

[unity] AddBoundingBoxAsComponent options.

John 8 жил өмнө
parent
commit
7ef8c6f9b0

+ 3 - 3
spine-unity/Assets/spine-unity/SkeletonUtility/SkeletonUtility.cs

@@ -73,15 +73,15 @@ namespace Spine.Unity {
 			return AddBoundingBoxAsComponent(box, slot, go, isTrigger);
 		}
 
-		public static PolygonCollider2D AddBoundingBoxAsComponent (BoundingBoxAttachment box, Slot slot, GameObject gameObject, bool isTrigger = true) {
+		public static PolygonCollider2D AddBoundingBoxAsComponent (BoundingBoxAttachment box, Slot slot, GameObject gameObject, bool isTrigger = true, bool isKinematic = true, float gravityScale = 0f) {
 			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;
+					rb.isKinematic = isKinematic;
+					rb.gravityScale = gravityScale;
 				}
 			}