aaa
This commit is contained in:
parent
f1c3af2b89
commit
2636d580a8
75 changed files with 3890 additions and 1084 deletions
|
|
@ -28,7 +28,6 @@
|
|||
if (item.y < p) { item.y = p; item.vy = Math.abs(item.vy || 0) * 0.72; item.spinVelocity *= -0.72; }
|
||||
if (item.y > worldRef.h - p) { item.y = worldRef.h - p; item.vy = -Math.abs(item.vy || 0) * 0.72; item.spinVelocity *= -0.72; }
|
||||
resolveObstacleCollisions(item, dt, worldRef);
|
||||
global.TarinaiItemDynamicPinSystem.tryBallPickup(item, worldRef);
|
||||
item.x = clamp(item.x, p, worldRef.w - p);
|
||||
item.y = clamp(item.y, p, worldRef.h - p);
|
||||
const groundFriction = Math.pow(0.72, dt);
|
||||
|
|
@ -198,7 +197,7 @@
|
|||
const bounceCircleOffRect = global.TarinaiPhysics?.bounceCircleOffRect;
|
||||
if (typeof bounceCircleOffRect !== "function") return;
|
||||
const hitRadius = (item.r || 18) + 2;
|
||||
const restitution = Number.isFinite(rect.restitution) ? rect.restitution : (item.type === "balloon" ? 0.54 : 0.78);
|
||||
const restitution = Number.isFinite(rect.restitution) ? rect.restitution : (item.type === "balloon" ? 0.82 : 1.25);
|
||||
const velocityDamp = rect.bounce ? 1.0 : (item.type === "balloon" ? 0.82 : 0.94);
|
||||
const minBounceSpeed = Math.max(0, Number(rect.minBounceSpeed || 0) || 0);
|
||||
const bounced = bounceCircleOffRect(item, rect, hitRadius, restitution, worldRef, {
|
||||
|
|
@ -222,11 +221,7 @@
|
|||
}
|
||||
|
||||
function normalizeAngleLocal(angle = 0, fallback = 0) {
|
||||
if (typeof normalizedItemAngle === "function") return normalizedItemAngle(angle, fallback);
|
||||
const twoPi = Math.PI * 2;
|
||||
const n = Number(angle);
|
||||
const base = Number.isFinite(n) ? n : (Number.isFinite(Number(fallback)) ? Number(fallback) : 0);
|
||||
return ((base % twoPi) + twoPi) % twoPi;
|
||||
return normalizedItemAngle(angle, fallback);
|
||||
}
|
||||
|
||||
function fanWindAngleFor(item) {
|
||||
|
|
@ -412,6 +407,10 @@
|
|||
target.vy = clamp((target.vy || 0) + ay * force * dt, -820, 820);
|
||||
if (type === "balloon") target.spinVelocity = clamp((target.spinVelocity || 0) + 3.2 * wind.falloff * dt, -12, 12);
|
||||
else if (type === "ball") target.spinVelocity = clamp((target.spinVelocity || 0) + 5.4 * wind.falloff * dt, -38, 38);
|
||||
// Promote wind-driven objects out of the sleeping heap immediately. Without
|
||||
// this, velocity accumulates while the target waits for its next scheduled
|
||||
// update and the object jumps in periodic bursts.
|
||||
global.TarinaiItemUpdateScheduler?.wakeItem?.(worldRef, target, 0.24);
|
||||
worldRef?.markSpatialDirty?.("fan-wind-item");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue