mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[unity] Fix DrawBoundingBox count checks.
This commit is contained in:
parent
e20428b026
commit
37e8f92867
@ -1839,7 +1839,7 @@ namespace Spine.Unity.Editor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void DrawBoundingBox (Slot slot, BoundingBoxAttachment box, Transform t) {
|
public static void DrawBoundingBox (Slot slot, BoundingBoxAttachment box, Transform t) {
|
||||||
if (box.Vertices.Length <= 0) return; // Handle cases where user creates a BoundingBoxAttachment but doesn't actually define it.
|
if (box.Vertices.Length <= 2) return; // Handle cases where user creates a BoundingBoxAttachment but doesn't actually define it.
|
||||||
|
|
||||||
var worldVerts = new float[box.Vertices.Length];
|
var worldVerts = new float[box.Vertices.Length];
|
||||||
box.ComputeWorldVertices(slot, worldVerts);
|
box.ComputeWorldVertices(slot, worldVerts);
|
||||||
@ -1848,7 +1848,8 @@ namespace Spine.Unity.Editor {
|
|||||||
Vector3 lastVert = Vector3.zero;
|
Vector3 lastVert = Vector3.zero;
|
||||||
Vector3 vert = Vector3.zero;
|
Vector3 vert = Vector3.zero;
|
||||||
Vector3 firstVert = t.TransformPoint(new Vector3(worldVerts[0], worldVerts[1], 0));
|
Vector3 firstVert = t.TransformPoint(new Vector3(worldVerts[0], worldVerts[1], 0));
|
||||||
for (int i = 0; i < worldVerts.Length; i += 2) {
|
int n = worldVerts.Length - 1;
|
||||||
|
for (int i = 0; i < n; i += 2) {
|
||||||
vert.x = worldVerts[i];
|
vert.x = worldVerts[i];
|
||||||
vert.y = worldVerts[i + 1];
|
vert.y = worldVerts[i + 1];
|
||||||
vert.z = 0;
|
vert.z = 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user