当前位置:网站首页>[unity introduction program] basic concepts - 2D collider collider 2D
[unity introduction program] basic concepts - 2D collider collider 2D
2022-07-25 07:33:00 【flashinggg】
Catalog
2D The role of the collision body
Box Collider 2D Box shaped impactor
2 Material texture of material
4 Used By Effector Effector switch
5 Used By Composite Mixing switch
6 Auto Tiling Automatically adapt tiles
Circle Collider 2D Circular impactor
Other attributes follow Box Collider 2D identical
Edge Collider 2D Edge collider
Other attributes follow Box Collider 2D identical
Polygon Collider 2D Polygon Collider
Other attributes follow Box Collider 2D identical
Capsule Collider 2D Capsule collider
Composite Collider 2D Composite collision body
5 Geometry Type Geometric type
6 Generation Type Geometry when changes occur
7 Vertex Distance Vertex distance limit
8 Offset Distance Offset distance limit
Other attributes follow Box Collider 2D identical
Custom Collider 2D Custom collider
Tilemap Collider 2D Tile Map collision body
Official help manual
2D Colliding body - Unity manual
I am using Unity edition
2021.3
2D The role of the collision body
- 2D The collision body corresponds to 2D The object of the game , Can't be 3D and 2D A mixture of ;
- This component can define the physical collision 2D The shape of the game object ;
- The shape does not need to be exactly the same as the game object , Rough approximation is more effective in game operation .
2D Type of collider
By searching, you can see ,1D Collision bodies have the following 8 Types .

Box Collider 2D Box shaped impactor
It is a rectangular collision box .

1 Edit Collider Edit Frame
Can be in Scene Adjust the border of the collider in the view , The border is a rectangle box.

2 Material texture of material
Associative materials , The default is a 2D Physical material Physics Material 2D, Used to adjust 2D When physical objects collide, the friction and elastic .
Assets -> create -> 2D -> Physics Material 2D You can create a new one Physics Material 2D, Default friction coefficient Friction -> 0.4, elastic Bounciness -> 0.

3 Is Trigger Trigger switch
After selection , This 2D The collision experience runs as a trigger , So what is trigger ? Take a look at my other article :Unity Study - trigger Trigger_flashinggg The blog of
4 Used By Effector Effector switch
If the collider uses Effectors 2D——2D Effector , You need to check this option to make the collision effect take effect . You can find the 2D Effector components are required and 2D Used in conjunction with collision bodies , About effectors, you can see this article first :【Unity】Unity 2D Game development ( Two )Effectors 2D Collision effectors
5 Used By Composite Mixing switch
If the collider uses Composite Collider 2D——2D Composite collision body , After checking this option, other attributes of the collision body will be ignored , Take the attributes of the composite collision body as the attributes of the collision body .
2D Composite collision body (Composite Collider 2D) - Unity manual
6 Auto Tiling Automatically adapt tiles
When Sprite renderer (Sprite Renderer) Of Draw Mode Set to Tiled when , Check Auto Tiling Can automatically adapt to Sprite Tile of .

About the sprite renderer, you can first see the official documents , Sprite renderer (Sprite Renderer) - Unity manual , I will study later .
7 Offset Offset adjustment
and Size Together , Used to adjust the position of the collider .
8 Size Boundary adjustment
and Offset Together , Used to adjust the position of the collider .
9 Edge Radius Corner radius
Control the radius around the edge , Is that the vertex is circular .( At present, it is not clear that this parameter is for Box Collider Influence )
Circle Collider 2D Circular impactor

1 Edit Collider Edit Frame
Can be in Scene Adjust the border of the collider in the view , The border is a circle .

6 Raidus radius
Change the size of the collision body .
Other attributes follow Box Collider 2D identical
Edge Collider 2D Edge collider

1 Edit Collider Edit Frame
Can be in Scene Adjust the border of the collider in the view , Outline yourself , This contour does not need to completely enclose an area , It can be a straight line or L shape .

7 Points Some information

Some information about contour points .
Other attributes follow Box Collider 2D identical
Polygon Collider 2D Polygon Collider

1 Edit Collider Edit Frame
Can be in Scene Adjust the border of the collider in the view , The border is automatically fitted according to the contour at first , You can modify it yourself . And Edge Collider The difference is , The edge of the polygon collision body must completely enclose an area .

Other attributes follow Box Collider 2D identical
Capsule Collider 2D Capsule collider
The capsule collider is composed of two hemispheres connected with a cylinder , It's like a capsule , Suitable for columnar objects .
Capsule collider (CapsuleCollider) - Sun‘ Dazzling blog - Blog Garden (cnblogs.com)

Composite Collider 2D Composite collision body
2D Composite collision body (Composite Collider 2D) - Unity manual
This collision body has no fixed shape , In the box shaped collision body mentioned above Box Collider Collide with polygon Poly Collider All have a property ——Used By Composite, Choose this option ,2D Composite colliders will merge their shapes .

5 Geometry Type Geometric type
After the merger , The vertices of the selected collider are combined into two different geometric types :
- Outlines—— Hollow contour , similar Edge Collider 2D
- Polygons—— Implement polygon , similar Polygon Collider 2D
6 Generation Type Geometry when changes occur
( This part is not very clear about what it can be used for , Write it down first .)
- Synchronous—— Automatically generate new aggregates immediately
- Manual—— Manual
7 Vertex Distance Vertex distance limit
Set a value , To regulate the minimum spacing allowed for any vertex collected from the collider , It can be used to control the effective resolution of fixed-point combination .
8 Offset Distance Offset distance limit
Be similar to Vertex Distance
Other attributes follow Box Collider 2D identical
Custom Collider 2D Custom collider

Need to use PhysicalShape2D To achieve custom , To be specific, see :
Custom Collider 2D - Unity manual
Tilemap Collider 2D Tile Map collision body

For the same game object Tilemap Each tile of the component generates a collision body , When creating a Tilemap Collider 2D when , It will automatically create one Tilemap Components :

About the optimization of this component :unity2d Tilemap Collider Optimize - You know (zhihu.com)
And the introduction of this component : Map of tiles 2D Colliding body (Tilemap Collider 2D) - Unity manual
边栏推荐
- [programmer 2 Civil Servant] IV. common problems
- UXDB怎么从日期值中提取时分秒?
- Tunnel broadcasting and wireless trunking communication broadcasting system - the case of Tiantaishan tunnel
- 做好项目管理的10个关键点和5大措施
- Summary of learning notes of deep learning application development (II)
- [cloud native] the ribbon is no longer used at the bottom of openfeign, which started in 2020.0.x
- Paddlepaddle 34 adjust the layer structure and forward process of the model (realize the addition, deletion, modification and forward modification of the layer)
- 深度学习制作数据集时,从长视频中指定每隔多少帧提取一张图像到指定文件路径的方法
- What are the types of financial products in 2022? Which is suitable for beginners?
- 3. Promise
猜你喜欢

PADS导出gerber文件

第一启富金怎么样

Leetcode118. Yanghui triangle

What has become a difficult problem for most people to change careers, so why do many people study software testing?

Nailing the latest version, how to clear the login phone number history data

cesium简介

leetcode刷题:动态规划06(整数拆分)

JS cannot get content disposition in headers
![[dynamic programming] - Knapsack model](/img/0d/c467e70457495f130ec217660cbea7.png)
[dynamic programming] - Knapsack model

diagramscene工程难点分析
随机推荐
【论文笔记】EFFICIENT CNN ARCHITECTURE DESIGN GUIDED BY VISUALIZATION
js无法获取headers中Content-Disposition
cesium简介
纳米数据足球数据,足球赛事比分,体育数据api,卡塔尔世界杯
NLP hotspots from ACL 2022 onsite experience
About --skip networking in gbase 8A
[programmer 2 Civil Servant] IV. common problems
J1 common DOS commands (P25)
QT学习日记20——飞机大战项目
Pads export Gerber file
第一启富金怎么样
轮询、中断、DMA和通道
3. Promise
Alibaba cloud image address & Netease cloud image
How does uxdb extract hours, minutes and seconds from date values?
【软件测试】包装简历从这几点出发、提升通过率
BOM overview
Talk about programmers learning English again
Practical skills -- some solutions to small problems
【云原生】原来2020.0.X版本开始的OpenFeign底层不再使用Ribbon了