当前位置:网站首页>Explain mesh Collider in unity
Explain mesh Collider in unity
2022-07-28 20:53:00 【Dream small day young】
Preface
The collider component defines the physical properties of the object ,Unity There are a series of basic collision bodies , We can use them to combine into any shape , But in addition to the basic collision body ,Untiy Also provided are grids (Mesh)、 wheel (Wheel)、 terrain (Terrain) Equal impactor , They are respectively used for the realization of tire functions 、 Collision of complex meshes 、 The collision of geographical environment , Today, I will briefly introduce the simple use of mesh collider .
Catalog
Front row reminders : This article only represents personal views , For exchange and learning , If you have different opinions, please comment , The author must study hard , Day day up .
When reading this article , If there is something you don't understand , It is recommended to watch the references listed in this article for comparison .
Before reading this article , Please understand first “ Rigid bodies and collision bodies ” Related knowledge .
Unity edition [2019.4.10f1] Dream small day young & Prohibited reproduced
One 、 grid (Mesh) Impactor
In general , Use basic collision bodies such as cubes 、 Combination of cylinder, etc , Enough to simulate percent 99 The shape of , But in the game , Some important characters or scene objects , Requires a particularly fine collision , At this time, it is the best choice to use the mesh Collider to build the collision of objects . The essence of mesh collision volume is to reference mesh to calculate collision .
Here is the grid (Mesh) And models (Model) The difference between :
grid : Contains definitions 3D Vertex information of object shape , That is, the shape of the model
Model : texture of material + Animation + texture + Shaders + grid = Model
What is said here is not rigorous enough , But my words are poor , Please understand .
Now let's actually operate , A model from creation to import to Unity And add the whole process of mesh collider
1.FBX The model is imported into Unity And used as mesh collider
Here we choose Blender3.1 To make models , Start by opening Blender, And then pass by … The operation of , We have created such a simple model , And set a simple material , Then export to FBX Format , Drag directly to Unity Of Assets in 

We can see , After import FBX The file has two sub files ,MM1 and TestMode, They are materials and meshes , When the two of them come together , It can be called a model . Let's drag the imported model resources into the scene .
We can see , The model resources imported for the first time have only basic Transfrom、Mesh Filter、Mesh Renderer Components , Not yet Collider, So we add Mesh Collider
It's done now , Let's briefly talk about the role of the remaining parameters .
2.Mesh Collider Parameters
1.Convex
The official explanation here is that the election will make Mesh Collider With other Mesh Collider Collide , To be honest, I didn't see what it meant .
Let me explain with two pictures , The first one is not checked Convex, Check the second one Convex

I believe you can see the difference here , Unchecked means that the model calculates the collision according to the grid , If checked, it means Unity The uneven part of the mesh will be filled up automatically .
Check the box that will definitely save resources , And after checking Is Trigger Options are also available , But if you check this, you might as well use the cylinder Collider to simulate the collision , It depends on the situation .
2.Cooking Options
How does the physics engine handle this grid ( Six options are given )
- None Disable all options
- Everything Enable all options
- Cook for Faster Simulation Faster simulation
- Enable Mesh Cleaning Enable mesh cleanup
- Weld Colocated Vertices Merge vertices with the same position
- Use Fast Midphase Use faster algorithms
The default is to select the last four items , Tell the truth , I don't quite understand these ( Well, it's all Greek ), Not much said , So as not to mislead people's children .
3.Physic Material
This option is used to simulate the physical material of the object surface , For the ground , For example, ice 、 wood 、 Cement board these . For the object itself , For example, the elasticity of physics itself , The smoothness of physics itself , Will directly affect the effect of physical simulation .
Physical material related can see me “ Explain rigid bodies and colliders ” In the article 2.3 section , I have written very clearly , I won't go into more details here .
4.Mesh
Reference the mesh that needs to be used for collisions , Not much to explain ,1.1 It's very clear
Two 、 Summary and references
1. summary
- Originally, I wanted to use an article to put the grid 、 The wheels and terrain are finished , But after touching the wheel, I found that there were too many things , So I decided to divide it into three parts , So this article is a little short .
- Something to watch out for :
- grid : Contains definitions 3D Vertex information of object shape
- Model : texture of material + Animation + texture + Shaders + grid = Model
- Mesh Collider Of Convex Parameters
- Used to set whether to fill the void
- FBX Import Unity in , There will be a material and mesh , They combined , It's called model ( Later, we will also open a new pit to talk about the import of various formats Unity The operation of )
2. Reference material
[1].Unity official .Unity Mesh collider
[2]. Pillow flow loves playing games &lzh0913hangUnity3d in MeshCollider Under components convex What's the use of checking ?( Baidu knows )
边栏推荐
- [C语言刷题篇]链表运用讲解
- 太空射击第09课:精灵动画
- H5 wechat shooting game source code
- View the thread stack according to the lwtid of opengauss/mogdb.
- 全链路灰度在数据库上我们是怎么做的?
- Pl515 SOT23-5 single / Dual Port USB charging protocol port controller Parkson electronic agent
- js飞入js特效弹窗登录框
- C reads the data in the CSV file and displays it after importing the DataTable
- Unity package project to vs deploy hololens process summary
- 太空射击第15课: 道具
猜你喜欢

Unity gets which button (toggle) is selected under togglegroup

How can enterprises successfully complete cloud migration?

Want to draw a picture that belongs to you? AI painting, you can also

Thinking and summary of R & D Efficiency

Subcontracting loading of wechat applet

Space shooting Lesson 11: sound and music

Unity makes prefabricated bodies with one key and modifies prefabricated bodies with one key

有奖征文 | 2022 云原生编程挑战赛征稿活动开启

Random talk on GIS data (VI) - projection coordinate system

TCP.IP
随机推荐
UE4.25 Slate源码解读
Sorting out problems in interface endpoint testing practice using Supertest
Network layer performance test
Three steps to teach you unity serial communication
MySQL error: specified key was too long; max key length is 767 bytes
Hangao database best practice configuration tool Hg_ BP log collection content
js可拖拽alert弹窗插件
How do we do full link grayscale on the database?
十七年运维老兵万字长文讲透优维低代码~
Unity object path query tool
Unity uses shader to quickly make a circular mask
#yyds干货盘点# 面试必刷TOP101:链表中的节点每k个一组翻转
LVS+KeepAlived高可用部署实战应用
Unity gets which button (toggle) is selected under togglegroup
About IP address
动态规划:背包问题模板代码汇总
Yyds dry inventory interview must brush top101: every k nodes in the linked list are turned over
Talking about canvas and three rendering modes in unity
High beam software has obtained Alibaba cloud product ecological integration certification, and is working with Alibaba cloud to build new cooperation
Laser slam:logo-loam --- code compilation, installation and gazebo test