This commit is contained in:
2026-01-23 15:29:49 -08:00
parent aaff3571af
commit 7408005ed2

View File

@@ -126,11 +126,12 @@
<!-- <polygon class="wall" points="20,-50 10,-50 10,-60 20,-60" /> --> <!-- <polygon class="wall" points="20,-50 10,-50 10,-60 20,-60" /> -->
<!-- <polygon class="wall" points="-10,10 10,10 10,40 -10,40" /> --> <!-- <polygon class="wall" points="-10,10 10,10 10,40 -10,40" /> -->
<polygon class="wall" points="-10,-40 10,-40 10,-20 -10,-20" /> <!-- <polygon class="wall" points="-10,-40 10,-40 10,-20 -10,-20" /> -->
<polygon class="wall" points="-10,-40 10,-40 10,-15 -10,-15" />
<!-- <polygon class="wall" points="-10,10 10,30 -10,40 -20,20" /> --> <!-- <polygon class="wall" points="-10,10 10,30 -10,40 -20,20" /> -->
<!-- <polygon class="wall" points="-20,-10 0,10 -20,20 -30,0" /> --> <!-- <polygon class="wall" points="-20,-10 0,10 -20,20 -30,0" /> -->
<polygon class="wall" points="-20,-10 20,10 -20,20 -30,0" /> <!-- <polygon class="wall" points="-20,-10 20,10 -20,20 -30,0" /> -->
<!-- <polygon class="wall" points="-20,-50 -10,-50 -10,-60 -20,-60" /> --> <!-- <polygon class="wall" points="-20,-50 -10,-50 -10,-60 -20,-60" /> -->
<!-- <polygon class="wall" points="20,50 10,50 10,60 20,60" /> --> <!-- <polygon class="wall" points="20,50 10,50 10,60 20,60" /> -->
@@ -512,7 +513,6 @@ const Move = (() => {
const rise = contact.edge.yb-contact.edge.ya; const rise = contact.edge.yb-contact.edge.ya;
const run = contact.edge.xb-contact.edge.xa; const run = contact.edge.xb-contact.edge.xa;
const normalVector = { x: rise, y: -run };
drawLine(p.x - v.x, p.y - v.y, p.x, p.y, "blue"); // velocity vector drawLine(p.x - v.x, p.y - v.y, p.x, p.y, "blue"); // velocity vector
drawLine(contact.edge.xa, contact.edge.ya, contact.edge.xb, contact.edge.yb, "green"); // edge vector drawLine(contact.edge.xa, contact.edge.ya, contact.edge.xb, contact.edge.yb, "green"); // edge vector
@@ -567,7 +567,7 @@ const Move = (() => {
newX = prAvx - prBvx; newX = prAvx - prBvx;
newY = prAvy - prBvy; newY = prAvy - prBvy;
drawLine(p.x, p.y, p.x + normalVector.x , p.y + normalVector.y, "black"); // edge normal vector drawLine(p.x, p.y, p.x + vec2.rightNormal.x , p.y + vec2.rightNormal.y, "black"); // edge normal vector
drawLine(p.x, p.y, p.x + newX , p.y + newY, "blue"); // bounced velocity vector drawLine(p.x, p.y, p.x + newX , p.y + newY, "blue"); // bounced velocity vector
Velocity[entity_id] = { x: newX, y: newY }; Velocity[entity_id] = { x: newX, y: newY };
@@ -664,9 +664,10 @@ function init() {
started = false; started = false;
const mult = 10; const mult = 10;
s.position = { x: 0, y: -10 }; s.position = { x: 0, y: 0 };
// s.velocity = { x: 0, y: -10 }; // s.velocity = { x: 0, y: -10 };
s.velocity = { x: 10, y: 20 }; // s.velocity = { x: 10, y: 20 };
s.velocity = { x: 0, y: 0 };
s.angularVelocity = 0; s.angularVelocity = 0;
// s. velocity = { x: -5*mult, y: 7*mult }; // s. velocity = { x: -5*mult, y: 7*mult };

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB