Version: 2019.3
Capsule Collider 2D
Physics Material 2D

Composite Collider 2D

Switch to Scripting

The Composite Collider 2D componentA functional part of a GameObject. A GameObject can contain any number of components. Unity has many built-in components, and you can create your own by writing scripts that inherit from MonoBehaviour. More info
See in Glossary
is a ColliderAn invisible shape that is used to handle physical collisions for an object. A collider doesn’t need to be exactly the same shape as the object’s mesh - a rough approximation is often more efficient and indistinguishable in gameplay. More info
See in Glossary
for use with 2D physics. Unlike most colliders, it does not define an inherent shape. Instead, it merges the shapes of any Box Collider 2D or Polygon Collider 2D that you set it up to use. The Composite Collider 2D uses the vertices (geometry) from any of these Colliders, and merges them together into new geometry controlled by the Composite Collider 2D itself.

The Box ColliderA cube-shaped collider component that handles collisions for GameObjects like dice and ice cubes. More info
See in Glossary
2D and Polygon Collider 2D components have a Used By Composite checkbox. Tick this checkbox to attach them to the Composite Collider 2D. These Colliders also have to be attached to the same Rigidbody 2D as the Composite Collider 2D. When you enable Used by Composite, other properties disappear from that component, because they are now controlled by the attached Composite Collider 2D.

See API documentation on Composite Collider 2D for more information about scripting with the Composite Collider 2D.

Property Function
Density Change the density to change the mass calculations of the GameObject’s associated RigidbodyA component that allows a GameObject to be affected by simulated gravity and other forces. More info
See in Glossary
2D. If you set the value to 0, its associated Rigidbody 2D ignores the Collider 2D for all mass calculations, including centre of mass calculations. Note that this option is only available if you have enabled Use Auto Mass in the associated Rigidbody 2D component.
MaterialAn asset that defines how a surface should be rendered, by including references to the Textures it uses, tiling information, Color tints and more. The available options for a Material depend on which Shader the Material is using. More info
See in Glossary
A Physics Material 2DUse to adjust the friction and bounce that occurs between 2D physics objects when they collide More info
See in Glossary
that determines the properties of collisionsA collision occurs when the physics engine detects that the colliders of two GameObjects make contact or overlap, when at least one has a rigidbody component and is in motion. More info
See in Glossary
, such as friction and bounce.
Is Trigger Check this box if you want the Composite Collider 2D to behave as a trigger (see overview documentation on Colliders to learn more about triggers).
Used by Effector Check this box if you want the Composite Collider 2D to be used by an attached Effector 2D component.
Offset Set the local offset of the Collider 2D geometry.
Geometry Type When merging Colliders, the vertices from the selected Colliders are composed into one of two different geometry types. Use this drop-down to set the geometry type to either Outlines or Polygons.
    Outlines Produces a Collider 2D with hollow outlines, identical to what the Edge Collider 2D produces.
    Polygons Produces a Collider 2D with solid polygons, identical to what the Polygon Collider 2D produces.
Generation Type The method used to control when geometry is generated when either the Composite Collider 2D is changed, or any of the Colliders it is composing is changed.
    Synchronous When a change is made to the Composite Collider 2D or any of the colliders it is using, Unity generates new geometry immediately.
    Manual New geometry generation happens only when you request it. To request generation, either call the CompositeCollider2D.GenerateGeometry script API, or click the Regenerate Geometry button that appears under the selection.
Vertex Distance Set a value for the minimum spacing allowed for any vertices gathered from Colliders being composed. Any vertex closer than this limit is removed. This allows control over the effective resolution of the vertex compositing.
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). This only works when the Geometry Type is set to Outlines.
Capsule Collider 2D
Physics Material 2D
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961