修复mover因为set遍历问题
This commit is contained in:
@@ -1619,21 +1619,21 @@ var es;
|
|||||||
}
|
}
|
||||||
// 移动所有的非触发碰撞器并获得最近的碰撞
|
// 移动所有的非触发碰撞器并获得最近的碰撞
|
||||||
var colliders = this.entity.getComponents(es.Collider);
|
var colliders = this.entity.getComponents(es.Collider);
|
||||||
for (var i = 0; i < colliders.length; i++) {
|
var _loop_1 = function (i) {
|
||||||
var collider = colliders[i];
|
var collider = colliders[i];
|
||||||
// 不检测触发器 在我们移动后会重新访问它
|
// 不检测触发器 在我们移动后会重新访问它
|
||||||
if (collider.isTrigger)
|
if (collider.isTrigger)
|
||||||
continue;
|
return "continue";
|
||||||
// 获取我们在新位置可能发生碰撞的任何东西
|
// 获取我们在新位置可能发生碰撞的任何东西
|
||||||
var bounds = collider.bounds;
|
var bounds = collider.bounds;
|
||||||
bounds.x += motion.x;
|
bounds.x += motion.x;
|
||||||
bounds.y += motion.y;
|
bounds.y += motion.y;
|
||||||
var neighbors = es.Physics.boxcastBroadphaseExcludingSelf(collider, bounds, collider.collidesWithLayers.value);
|
var neighbors = es.Physics.boxcastBroadphaseExcludingSelf(collider, bounds, collider.collidesWithLayers.value);
|
||||||
for (var j = 0; j < neighbors.size; j++) {
|
neighbors.forEach(function (value) {
|
||||||
var neighbor = neighbors[j];
|
var neighbor = value;
|
||||||
// 不检测触发器
|
// 不检测触发器
|
||||||
if (neighbor.isTrigger)
|
if (neighbor.isTrigger)
|
||||||
continue;
|
return;
|
||||||
var _internalcollisionResult = new es.CollisionResult();
|
var _internalcollisionResult = new es.CollisionResult();
|
||||||
if (collider.collidesWith(neighbor, motion, _internalcollisionResult)) {
|
if (collider.collidesWith(neighbor, motion, _internalcollisionResult)) {
|
||||||
// 如果碰撞 则退回之前的移动量
|
// 如果碰撞 则退回之前的移动量
|
||||||
@@ -1643,7 +1643,10 @@ var es;
|
|||||||
collisionResult = _internalcollisionResult;
|
collisionResult = _internalcollisionResult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
};
|
||||||
|
for (var i = 0; i < colliders.length; i++) {
|
||||||
|
_loop_1(i);
|
||||||
}
|
}
|
||||||
es.ListPool.free(colliders);
|
es.ListPool.free(colliders);
|
||||||
return collisionResult.collider != null;
|
return collisionResult.collider != null;
|
||||||
|
|||||||
2
source/bin/framework.min.js
vendored
2
source/bin/framework.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -38,11 +38,11 @@ module es {
|
|||||||
bounds.y += motion.y;
|
bounds.y += motion.y;
|
||||||
let neighbors = Physics.boxcastBroadphaseExcludingSelf(collider, bounds, collider.collidesWithLayers.value);
|
let neighbors = Physics.boxcastBroadphaseExcludingSelf(collider, bounds, collider.collidesWithLayers.value);
|
||||||
|
|
||||||
for (let j = 0; j < neighbors.size; j++) {
|
neighbors.forEach(value => {
|
||||||
let neighbor = neighbors[j];
|
let neighbor = value;
|
||||||
// 不检测触发器
|
// 不检测触发器
|
||||||
if (neighbor.isTrigger)
|
if (neighbor.isTrigger)
|
||||||
continue;
|
return;
|
||||||
|
|
||||||
let _internalcollisionResult: CollisionResult = new CollisionResult();
|
let _internalcollisionResult: CollisionResult = new CollisionResult();
|
||||||
if (collider.collidesWith(neighbor, motion, _internalcollisionResult)) {
|
if (collider.collidesWith(neighbor, motion, _internalcollisionResult)) {
|
||||||
@@ -54,7 +54,7 @@ module es {
|
|||||||
collisionResult = _internalcollisionResult;
|
collisionResult = _internalcollisionResult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ListPool.free(colliders);
|
ListPool.free(colliders);
|
||||||
|
|||||||
Reference in New Issue
Block a user