fix: collision mutex

This commit is contained in:
cha0s 2024-07-26 08:40:53 -05:00
parent 91d0f481d6
commit 628e0cae48

View File

@ -77,7 +77,27 @@ export default class Collider extends Component {
intersection.entity.bodies[intersection.i],
intersection.other.bodies[intersection.j],
];
if (!activeIntersections.has(intersection)) {
let hasMatchingIntersection = false;
for (const activeIntersection of activeIntersections) {
if (
(
activeIntersection.entity === intersection.entity
&& activeIntersection.other === intersection.other
&& activeIntersection.i === intersection.i
&& activeIntersection.j === intersection.j
)
|| (
activeIntersection.entity === intersection.other
&& activeIntersection.other === intersection.entity
&& activeIntersection.i === intersection.j
&& activeIntersection.j === intersection.i
)
) {
hasMatchingIntersection = true;
break;
}
}
if (!hasMatchingIntersection) {
if (this.$$collisionStart) {
const script = this.$$collisionStart.clone();
script.context.other = otherEntity;