rm push/pop
This commit is contained in:
@@ -73,7 +73,7 @@ collision2d.overlap = function(body, pos, others) {
|
||||
for (i = 0; i < length(others); i++) {
|
||||
other = others[i]
|
||||
if (collision2d.test(body, pos, other.body, other.pos))
|
||||
push(results, other)
|
||||
results[] = other
|
||||
}
|
||||
return results
|
||||
}
|
||||
@@ -94,12 +94,12 @@ collision2d.overlap_point = function(point, bodies) {
|
||||
hw = b.body.width * 0.5
|
||||
hh = b.body.height * 0.5
|
||||
if (abs(point.x - c.x) < hw && abs(point.y - c.y) < hh)
|
||||
push(results, b)
|
||||
results[] = b
|
||||
} else if (b.body.type == 'circle') {
|
||||
dx = point.x - c.x
|
||||
dy = point.y - c.y
|
||||
if (dx * dx + dy * dy < b.body.radius * b.body.radius)
|
||||
push(results, b)
|
||||
results[] = b
|
||||
}
|
||||
}
|
||||
return results
|
||||
|
||||
Reference in New Issue
Block a user