diff --git a/html/images/space.svg b/html/images/space.svg
index 9d34f0e..6412550 100644
--- a/html/images/space.svg
+++ b/html/images/space.svg
@@ -499,11 +499,14 @@ const Move = (() => {
Position[entity_id] = cornerContactPosition(p.x, p.y, px, py, contact.corner, s.radius);
} else if (contact.edge) {
// if (isLandable(contact.edge) && s.gearDown) s.isLanded = true;
+ const isHorizontal = contact.edge.ya === contact.edge.yb;
+ const isVertical = contact.edge.xa === contact.edge.xb;
+
console.log("CURRENT POSITION", px, py);
console.log("INTENDED POSITION", p.x, p.y);
console.log("CONTACT POSITION", contact.position);
- if (contact.edge.ya === contact.edge.yb) {
+ if (isHorizontal) {
if (contact.edge.xa < contact.edge.xb) {
if (v.y <= 0) {
Velocity[entity_id] = { x: v.x, y: v.y };
@@ -521,6 +524,27 @@ const Move = (() => {
Position[entity_id] = { x: p.x, y: p.y };
}
}
+ } else if (isVertical) {
+ if (contact.edge.ya > contact.edge.yb) {
+ if (v.x <= 0) {
+ Velocity[entity_id] = { x: v.x, y: v.y };
+ Position[entity_id] = { x: p.x, y: p.y };
+ } else if (v.x > 0) {
+ Velocity[entity_id] = { x: 0, y: v.y };
+ Position[entity_id] = { x: contact.position.x, y: p.y };
+ }
+ } else if (contact.edge.ya < contact.edge.yb) {
+ if (v.x <= 0) {
+ Velocity[entity_id] = { x: 0, y: v.y };
+ Position[entity_id] = { x: contact.position.x, y: p.y };
+ } else if (v.x > 0) {
+ Velocity[entity_id] = { x: v.x, y: v.y };
+ Position[entity_id] = { x: p.x, y: p.y };
+ }
+ }
+
+ } else {
+
}
}
} else {