rr
This commit is contained in:
parent
2636d580a8
commit
d14550dad6
78 changed files with 2827 additions and 563 deletions
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
const Geometry = global.TarinaiGeometry;
|
||||
const BOUNCE_FENCE_RESTITUTION = 4.20;
|
||||
const ORDINARY_FENCE_RESTITUTION = 0.38;
|
||||
const BOUNCE_FENCE_MIN_SPEED = 820;
|
||||
const BOUNCE_FENCE_MAX_SPEED = 1680;
|
||||
|
||||
|
|
@ -330,7 +331,8 @@
|
|||
cx: it.x || 0, cy: it.y || 0, halfW, halfH, angle, cos: aabb.cos, sin: aabb.sin, oriented: true,
|
||||
vertical: Math.abs(Math.sin(angle)) > Math.abs(Math.cos(angle)), horizontal: Math.abs(Math.cos(angle)) >= Math.abs(Math.sin(angle)),
|
||||
bounce, gate, glassWall, oneWay, oneWayNx: Math.sin(angle), oneWayNy: -Math.cos(angle), gateOpen: Boolean(it.gateOpen),
|
||||
restitution: bounce ? BOUNCE_FENCE_RESTITUTION : undefined, minBounceSpeed: bounce ? BOUNCE_FENCE_MIN_SPEED : undefined
|
||||
restitution: bounce ? BOUNCE_FENCE_RESTITUTION : ORDINARY_FENCE_RESTITUTION,
|
||||
minBounceSpeed: bounce ? BOUNCE_FENCE_MIN_SPEED : undefined
|
||||
};
|
||||
},
|
||||
|
||||
|
|
@ -755,7 +757,7 @@
|
|||
t.lastBounceFenceImpulseAt = now;
|
||||
t._sleepExternalMotionUntil = Math.max(Number(t._sleepExternalMotionUntil || 0) || 0, now + 1.15);
|
||||
global.TarinaiMovementUpdateStep?.markSleepExternalMotion?.(t, 0.016, "bounce-fence-launch");
|
||||
if (t.sleeping || t.state === "sleep") global.TarinaiMovementUpdateStep?.wakeSleepingFromExternalMotion?.(t, "バウンス柵で跳ね飛ばされた");
|
||||
if (t.sleeping || t.state === "sleep") global.TarinaiMovementUpdateStep?.wakeSleepingFromExternalMotion?.(t, "\u30d0\u30a6\u30f3\u30b9\u67f5\u3067\u8df3\u306d\u98db\u3070\u3055\u308c\u305f");
|
||||
t.fallTimer = Math.max(Number(t.fallTimer || 0) || 0, 0.62);
|
||||
t.fallMax = Math.max(Number(t.fallMax || 0) || 0, Number(t.fallTimer || 0) || 0);
|
||||
// Clear the body beyond the contact skin so the multi-pass collision
|
||||
|
|
@ -800,7 +802,7 @@
|
|||
const moveX = Number(dx || 0) || 0;
|
||||
const moveY = Number(dy || 0) || 0;
|
||||
const dist = Math.hypot(moveX, moveY);
|
||||
if (dist <= 0.0001) return this.resolveSolidObstacleCollision(t, { maxPasses: 2, reason: opts.reason || "tarinai-stationary" });
|
||||
if (dist <= 0.0001) return this.resolveSolidObstacleCollision(t, { maxPasses: 2 });
|
||||
if (this.isTarinaiHiddenInNestBox?.(t)) {
|
||||
t.x += moveX;
|
||||
t.y += moveY;
|
||||
|
|
@ -842,7 +844,6 @@
|
|||
slop: 0.30,
|
||||
oneWayDx: stepX,
|
||||
oneWayDy: stepY,
|
||||
reason: opts.reason || "tarinai-swept-hit",
|
||||
}) || true;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -856,7 +857,6 @@
|
|||
slop: 0.35,
|
||||
oneWayDx: stepX,
|
||||
oneWayDy: stepY,
|
||||
reason: opts.reason || "tarinai-swept-move",
|
||||
});
|
||||
collided = passHit || collided;
|
||||
}
|
||||
|
|
@ -901,7 +901,7 @@
|
|||
},
|
||||
|
||||
resolveFenceCollision(t) {
|
||||
return this.resolveSolidObstacleCollision(t, { maxPasses: 2, reason: "resolve-fence" });
|
||||
return this.resolveSolidObstacleCollision(t, { maxPasses: 2 });
|
||||
},
|
||||
|
||||
segmentIntersectsRect(x1, y1, x2, y2, r) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue