Version: 2017.4
Sprite Editor:Edit Outline
Sprite Packer

Sprite Editor: Edit Physics Shape

概述

The Sprite Editor’s Edit Physics Shape allows you to edit a Sprite’s Physics Shape, which defines the initial shape of the Sprite’s Collider 2D Mesh. You can further refine the Physics Shape through the Collider’s component settings.

要编辑精灵的物理形状,请执行以下操作:

1.在 Project 窗口中,选择要更改的精灵。 2.在 Inspector 窗口中,单击 Sprite Editor 按钮。 3. In the Sprite Editor window, select the top left drop-down menu and choose Edit Physics Shape.

Edit Physics Shape option in the Sprite Editor window
Edit Physics Shape option in the Sprite Editor window

属性

属性 功能
Snap 将控制点贴靠到最近的像素。
Outline Tolerance 使用此属性可控制生成的轮廓贴合精灵纹理轮廓的紧密程度。在最小值 (0) 时,Sprite Editor 会在精灵周围生成基本轮廓。在最大值 (1) 时,Sprite Editor 生成一个尽可能贴合精灵像素轮廓的轮廓。

标准工作流程

Select your Sprite and select the Edit Physics Shape in the Sprite Editor, which automatically creates an outline of the Physics Shape with control points. By default, the generated outline follows the shape of the original Sprite texture, and also takes into account transparent areas.

Use the Outline Tolerance slider to further refine the outline of the Physics Shape. When you adjust the Outline Tolerance value, click Update to refresh the outline.

The Outline Tolerance slider
The Outline Tolerance slider

To change the overall outline of the Physics Shape, click and drag each control point.

When you hover the mouse over the outline, a transparent control point appears along the edge. Click to create a new control point at that spot. To remove a control point, select it and press the Del key (Windows) or Command+Del keys (macOS).

Hover over an empty spot on the Outline
Hover over an empty spot on the Outline
Click to create a new Control Point
Click to create a new Control Point

单击并拖动一个区域可选择多个控制点。在选择多个控制点后可以将它们一起放置在某个位置或将它们全部删除。

Press and hold the Ctrl key to select edges instead of their control points. Click on the highlighted edge to drag them into a new position.

Working with multiple outlines

A single Physics Shape can contain multiple separate outlines. This is useful if only specific areas of a Sprite need a Collider 2D Mesh for collision. For example, you might want a character to only respond to collisions on specific areas of its Sprite for damage.

Click and drag over any empty space in the Sprite Editor window. This creates a new rectangular outline with 4 control points. Repeast this step to create additional outlines. You can refine each outline the same way you would with a single Physics Shape outline.

更多提示

If you edit the outline of a Sprite that existing GameObjects already use as a reference, right-click the title of the Collider 2D component and select Reset. This updates the shape of the Collider meshes.


2018–05–24页面已发布并进行了编辑审查

Sprite Editor:Edit Outline
Sprite Packer