mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 22:34:53 +08:00
[unity] AddBoundingBoxAsComponent options.
This commit is contained in:
parent
afd8272dc6
commit
7ef8c6f9b0
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user