修复boxcollider碰撞问题

This commit is contained in:
yhh
2020-07-09 14:16:10 +08:00
parent aea50926a9
commit 6e3eb1189a
22 changed files with 241 additions and 177 deletions

View File

@@ -51,11 +51,11 @@ class SpatialHash {
let p2 = this.cellCoords(bounds.right, bounds.bottom);
// 更新边界以跟踪网格大小
if (!this.gridBounds.containsInVec(new Vector2(p1.x, p1.y))) {
if (!this.gridBounds.contains(p1.x, p1.y)) {
this.gridBounds = RectangleExt.union(this.gridBounds, p1);
}
if (!this.gridBounds.containsInVec(new Vector2(p2.x, p2.y))) {
if (!this.gridBounds.contains(p2.x, p2.y)) {
this.gridBounds = RectangleExt.union(this.gridBounds, p2);
}
@@ -190,6 +190,10 @@ class NumberDictionary {
return Long.fromNumber(x).shiftLeft(32).or(this.intToUint(y)).toString();
}
/**
*
* @param i
*/
private intToUint(i) {
if (i >= 0)
return i;