当前位置:网站首页>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 )
边栏推荐
- 一文了解 Rainbond 云原生应用管理平台
- NAT实验演示(Huawei交换机设备配置)
- 微信公众号授权登录后报redirect_uri参数错误的问题
- Explain rigid body and collider components in unity
- Three steps to teach you unity serial communication
- How to make the design of governance structure more flexible when the homogenization token is combined with NFT?
- 太空游戏第12课: 盾牌
- 想画一张版权属于你的图吗?AI作画,你也可以
- Space shooting Lesson 13: explosion effect
- How to balance security and performance in SQL?
猜你喜欢

JS fly into JS special effect pop-up login box

“当你不再是程序员,很多事会脱离掌控”—— 对话全球最大独立开源公司SUSE CTO...

Unity uses shader to quickly make a circular mask

js网页黑白背景开关js特效
![【ADB常用命令及其用法大全(来自[醒不了的星期八]的全面总结)】](/img/63/91b53b0ba718537383a97df59fe573.png)
【ADB常用命令及其用法大全(来自[醒不了的星期八]的全面总结)】

js可拖拽alert弹窗插件

Unity package exe to read and write excel table files

Space shooting Lesson 11: sound and music

Redis的三种删除策略以及逐出算法

PL515 SOT23-5 单/双口 USB 充电协议端口控制器 百盛电子代理商
随机推荐
Easynlp Chinese text and image generation model takes you to become an artist in seconds
融合数据库生态:利用 EventBridge 构建 CDC 应用
Network shell
JS picture hanging style photo wall JS special effect
Want to draw a picture that belongs to you? AI painting, you can also
动态规划:背包问题模板代码汇总
研发效能的思考总结
Introduction to redis II: RedHat 6.5 installation and use
Lvs+keepalived high availability deployment practical application
"When you are no longer a programmer, many things will get out of control" -- talk to SUSE CTO, the world's largest independent open source company
既要便捷、安全+智能,也要颜值,萤石发布北斗星人脸锁DL30F和极光人脸视频锁Y3000FV
Report redirect after authorized login on wechat official account_ The problem of wrong URI parameters
Record an error in runtime. Getruntime().Exec ("command")
Three steps to teach you unity serial communication
Yum package management
[C语言刷题篇]链表运用讲解
PL515 SOT23-5 单/双口 USB 充电协议端口控制器 百盛电子代理商
想画一张版权属于你的图吗?AI作画,你也可以
About the title of linking to other pages
Space shooting Lesson 11: sound and music