码迷,mamicode.com
首页 > 其他好文 > 详细

Polygon Collider 2D

时间:2017-03-27 15:45:50      阅读:336      评论:0      收藏:0      [点我收藏+]

标签:ref   available   location   sse   cmd   manual   sprite   auto   刚体   

The Polygon Collider 2D component is a collider for use with 2D physics. The collider’s shape is defined by a freeform edge made of line segments, so you can adjust it to fit the shape of the Sprite graphic with great precision. Note that this collider’s edge must completely enclose an area (unlike the similar Edge Collider 2D).

技术分享

Property:Function:
Density Changing the density here affects the mass of the object’s associated Rigidbody. Set the value to zero and its associated Rigidbody ignores the Collider for all mass calculations, including centre of mass calculations. NOTE: This option is only available if you have selected Use Auto Mass in an associated Rigidbody.(刚体勾选了auto之后,根据area计算重量)
Material A physics material that determines properties of collisions, such as friction and bounce.物理材质
Is Trigger Does the collider behave as a trigger?
Used by Effector Whether the collider is used by an attached effector or not.
Offset The local offset of the collider geometry.
Points Non-editable information about the complexity of the generated collider.一开始编辑只有一套点,选择size为,第二套点大小为三,手动设置3个不在一条直线上的点,大一点,能方便看到 例如0,0 0.5,0  0,0.5 ,看到后手动编辑。如果物体有空心的话,可以用。

Details

The collider can be edited manually but it is often more convenient to let Unity determine the shape automatically. You can do this by dragging a sprite asset from the Project view onto the Polygon Collider 2D component in the inspector、当加上poly组件时候,unity会自动根据形状进行初步加点

You can edit the polygon’s shape by pressing the Edit Collider button in the Inspector. You can exit collider edit mode by pressing the Edit Collider button again. While in edit mode, you can move an existing vertex by dragging when the mouse is over that vertex. If you shift-drag while the mouse is over an edge then a new vertex will be created at the mouse location. You can remove a vertex by holding down the ctrl/cmd key while clicking on it.按ctrl减点

Note that you can hide the outline of the 2D move gizmo while editing the collider - just click the foldout arrow on the Sprite Renderer component in the Inspector to collapse it.

Polygon Collider 2D

标签:ref   available   location   sse   cmd   manual   sprite   auto   刚体   

原文地址:http://www.cnblogs.com/ptqueen/p/6626806.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!