The Box Collider 2D is a Collider that interacts with the 2D physics system. It is a rectangle in shape with a defined position, width and height in the local coordinate space of a Sprite. Note that the rectangle is axis-aligned, with its edges parallel to the X or Y axes of local space.
属性 | 功能 |
---|---|
Material | 一种物理材质,可用于确定碰撞的属性(例如摩擦和弹性)。 |
Is Trigger | 如果希望 2D 盒型碰撞体作为触发器运行,请选中此框。 |
Used by Effector | 如果希望 2D 盒型碰撞体由附加的 2D 效应器组件使用,请选中此框。 |
Used by Composite | Tick this checkbox if you want this Collider to be used by an attached Composite Collider 2D. When you enable Used by Composite, other properties disappear from the Box Collider 2D component, because they are now controlled by the attached Composite Collider 2D. The properties that disappear from the Box Collider 2D are Material, Is Trigger, Used By Effector, and Edge Radius. |
Auto Tiling | Tick this checkbox if the Sprite Renderer component for the selected Sprite has the Draw Mode set to Tiled. This enables automatic updates to the shape of the Collider 2D, meaning that the shape is automatically readjusted when the Sprite’s dimensions change. If you don’t enable Auto Tiling, the Collider 2D geometry doesn’t automatically repeat. |
Offset | 设置 2D 碰撞体几何形状的局部偏移。 |
Size | 按局部空间单位设置盒体的大小。 |
Edge Radius | Controls a radius around edges, so that vertices are circular. This results in a larger Collider 2D with rounded convex corners. The default value for this setting is 0 (no radius). |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.