aabb방식일때 충돌 감지
- User
aabb방식일때 충돌 감지
Assistant
AABB(Axis-Aligned Bounding Box) 방식의 충돌 감지는 2D와 3D 모두에서 가장 기본적이고 효율적인 충돌 검사 방법입니다.
2D AABB 충돌 감지
두 개의 사각형이 겹치는지 확인하는 방법입니다:
def aabb_collision_2d(box1, box2): # box = [x, y, width, height] x1, y1, w1, h1 = box1 x2, y2, w2, h2 = box2 # 각 축에서 겹치는지 확인 x_overlap = x1 < x2 + w2 and x1 + w1 > x2 y_overlap = y1 < y2 + h2 and y1 + h1 > y2 return x_overlap and y_overlap또는 min/max 좌표를 사용하는 방법:
def aabb_collision_2d_minmax(box1, box2): # box = [min_x, min_y, max_x, max_y] return (box1[0] <= box2[2] and box1[2] >= box2[0] and box1[1] <= box2[3] and box1[3] >= box2[1])3D AABB 충돌 감지
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.