---
title: "Hit Shapes - s&box library"
description: "non-rectangular UI regions in s&box"
canonical: "https://sbox.watch/zh-cn/libraries/xaz/hit_shapes/"
generated_at: "2026-11-27T18:22:25.402Z"
---

# Hit Shapes

non-rectangular UI regions in s&box

- 类型: 库
- 标识符: xaz.hit_shapes
- 创作者: xazware
- 规范地址: https://sbox.watch/zh-cn/libraries/xaz/hit_shapes/
- Markdown: https://sbox.watch/zh-cn/libraries/xaz/hit_shapes/index.md
- sbox.game: https://sbox.game/xaz/hit_shapes/
- 生成时间: 2026-11-27T18:22:25.402Z

## 统计

- 24小时热度: +0
- Terry 评分: 43%
- 收藏: 3
- 好评: 2
- 差评: 0
- 更新时间: 2026年6月6日
- 创建时间: 2026年5月25日
- 大小: 67.5 KB
- 文件: 28
- 标签: css, custom, hit, hitbox, razor, scss, shape, shapes

## 描述

Hit Shapes
Non-rectangular UI regions in s&box

Hit Shapes wraps a shape resolver in a state machine that turns whole-panel mouse events into per-slot OnSlotEnter / OnSlotLeave / OnSlotClick callbacks.

Depends only on Vector2 and MousePanelEvent

Quick start example:
- Download the library
- Make a screen panel GameObject
- Add UI Panel --> Razor Hit Shape Demo
- Link camera to the Screen Panel
- Hit play

Built-in shapes

 Radial(slots, innerRatio?, outerRatio?) - Wheel of equal wedges - 0..slots-1, clockwise from 12 o'clock
 RectGrid(cols, rows) - Uniform grid - row-major, top-left = 0
 Polygon(verts) - One polygon, unit coords - always 0 if inside
 Polygons(polys) - Many polygons - index of first containing polygon
 Custom(slotCount, nativeSize, fn) - Resolver de-scaled to a fixed pixel frame - whatever you return
 CustomRaw(slotCount, fn) - Resolver receives raw engine-frame coords - whatever you return
 Union(a, b) - A's slots, then B's offset by A.SlotCount - A wins on overlap
 Intersect(a, b) - A's slot, only where B also resolves - A's slot count
 Difference(a, b) - A's slot, where B does NOT resolve - A's slot count



## More by xazware

| Package | 标识符 | 玩家 | 收藏 | 好评 | 评分 | Markdown |
| --- | --- | --- | --- | --- | --- | --- |
| Razor Designer | xaz.razordesigner | 0 | 15 | 16 | 86% | https://sbox.watch/zh-cn/libraries/xaz/razordesigner/index.md |
| goo | xaz.goo | 0 | 10 | 14 | 84% | https://sbox.watch/zh-cn/libraries/xaz/goo/index.md |
| Test library | xaz.gooui | 0 | 0 | 0 | -- | https://sbox.watch/zh-cn/libraries/xaz/gooui/index.md |
