Land on legs

This commit is contained in:
2025-12-29 16:11:43 -08:00
parent 6723e5f5af
commit 08c71c05e6

View File

@@ -524,9 +524,10 @@
const edge = z.find(({ edge: pts, node: ee }) => {
const str = `${pts.xa},${pts.ya} ${pts.xb},${pts.yb}`;
return detectEdgeCollision(position, pts, shipRadius);
}
);
const r = Object.is(slope(pts), 0) && s.gearDown ? shipRadius + 1 : shipRadius;
return detectEdgeCollision(position, pts, r);
});
return edge || actualCorner;
}
@@ -617,7 +618,7 @@
if (!current && s.collision) {
const baseSlope = slope(s.collision.edge);
if (Object.is(baseSlope, 0) && s.gearDown) s.isLanded = true;
const clPos = collisionPosition(s.collision.edge, s.position, s.velocity, shipRadius);
const clPos = collisionPosition(s.collision.edge, s.position, s.velocity, s.gearDown && Object.is(baseSlope, 0) ? shipRadius + 1 : shipRadius);
s.velocity = { x: 0, y: 0 };
s.position = { x: clPos.x, y: clPos.y }
s.node.style.transform = `translate(${s.position.x}px, ${s.position.y}px)`;

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB