Fix cannon length

This commit is contained in:
2026-02-05 14:54:51 -08:00
parent c783394d01
commit 4f9db0a940

View File

@@ -107,7 +107,7 @@
<!-- <polygon class="wall inverse" points="-160,-40 -170,-120 40,-110 170,-120 160,40 170,130 -40,110 -170,120" /> -->
<g id="player" class="ship">
<line id="cannon" x1="0" y1="0" x2="3" y2="0" stroke="black"/>
<line id="cannon" x1="0" y1="0" x2="8" y2="0" stroke="black"/>
<circle id="body" cx="0" cy="0" r="5"/>
<line id="velocity-indicator" x1="0" y1="0" x2="0" y2="0"/>
<line id="acceleration-indicator" x1="0" y1="0" x2="0" y2="0"/>
@@ -468,8 +468,8 @@ const Move = (() => {
const edgeSeg = getEdgeCollisionBoundary(edge, dist);
const positionSeg = { xa: x, ya: y, xb: xc, yb: yc };
console.log("edge", edge);
console.log("edgeSeg", edgeSeg);
// console.log("edge", edge);
// console.log("edgeSeg", edgeSeg);
const { xa: x1, ya: y1, xb: x2, yb: y2 } = positionSeg;
const { xa: x3, ya: y3, xb: x4, yb: y4 } = edgeSeg;
@@ -565,7 +565,7 @@ const Move = (() => {
const ysrOff = Math.round(y1r + (sr - 1) * (y2r - y1r)) / 100;
collision.position = { x: xsrOff, y: ysrOff };
drawLine(x3, y3, x4, y4, "red");
// drawLine(x3, y3, x4, y4, "red");
return true;
}
}
@@ -850,13 +850,13 @@ const Move = (() => {
// console.log("velocity", Velocity[entity_id]);
// console.log("current position", px, py);
drawCircle(px, py, "pink");
// drawCircle(px, py, "pink");
// console.log("contact.position", contact.position, "dett");
drawCircle(contact.position.x, contact.position.y, "limegreen");
// drawCircle(contact.position.x, contact.position.y, "limegreen");
// console.log("intended next position", p);
drawCircle(p.x, p.y, "red");
// drawCircle(p.x, p.y, "red");
let newP = {
// x: contact.position.x + elapsed * prVonNx * metersPerMillisecond,
@@ -903,7 +903,7 @@ const Move = (() => {
// if an edge passes through a point, is that point in the wall's fill? yes
// so touching a wall is technically being in its fill
drawCircle(newP.x, newP.y, "black");
// drawCircle(newP.x, newP.y, "black");
Position[entity_id] = newP;
}

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB