mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-02-28 17:37:07 +08:00
fix: 圆与矩形相交
This commit is contained in:
parent
3202cffd5d
commit
3261572365
@ -414,7 +414,7 @@ export namespace Hitbox {
|
||||
const { x: cx, y: cy, radius: r } = circle;
|
||||
const { x, y, w, h } = rect;
|
||||
|
||||
if (cx > x && cx < x + w && cy > y && cy < y + h) return false;
|
||||
if (cx > x && cx < x + w && cy > y && cy < y + h) return true;
|
||||
|
||||
// 找到圆心到矩形的最近点
|
||||
const closestX = Math.max(x, Math.min(cx, x + w));
|
||||
|
Loading…
Reference in New Issue
Block a user