mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 22:34:53 +08:00
Merge branch 'master' into 3.6-beta
This commit is contained in:
commit
1f47f45574
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user