修复 triggerlistener 发生碰撞后不断触发问题(仅第一次碰撞触发)
This commit is contained in:
@@ -94,8 +94,10 @@ class SpatialHash {
|
||||
if (collider == excludeCollider || !Flags.isFlagSet(layerMask, collider.physicsLayer))
|
||||
continue;
|
||||
|
||||
if (bounds.intersects(collider.bounds))
|
||||
this._tempHashSet.push(collider);
|
||||
if (bounds.intersects(collider.bounds)){
|
||||
if (this._tempHashSet.indexOf(collider) == -1)
|
||||
this._tempHashSet.push(collider);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -157,14 +159,6 @@ class NumberDictionary {
|
||||
return this._store.get(this.getKey(x, y));
|
||||
}
|
||||
|
||||
public getAllObjects(): Collider[] {
|
||||
let set: Collider[] = [];
|
||||
|
||||
this._store.forEach(list => set.concat(list));
|
||||
|
||||
return set;
|
||||
}
|
||||
|
||||
public clear() {
|
||||
this._store.clear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user