当前位置:网站首页>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 )
边栏推荐
- 不懂就问,快速成为容器服务进阶玩家!
- 什么是数据中台?数据中台带来了哪些价值?_光点科技
- Soft raid
- About the title of linking to other pages
- 网络各层性能测试
- Redis 3.0 source code analysis - data structure and object SDS list Dict
- Unity performance optimization scheme arrangement
- Introduction to redis II: RedHat 6.5 installation and use
- 太空射击第15课: 道具
- Space shooting Lesson 13: explosion effect
猜你喜欢
Random talk on GIS data (VI) - projection coordinate system
EasyNLP中文文图生成模型带你秒变艺术家
不懂就问,快速成为容器服务进阶玩家!
[complete collection of common ADB commands and their usage (from a comprehensive summary of [wake up on Sunday)]
Integrating database Ecology: using eventbridge to build CDC applications
What is data center? What value does the data center bring_ Light spot technology
js飞入js特效弹窗登录框
Nat experiment demonstration (Huawei switch equipment configuration)
[server data recovery] HP StorageWorks series storage RAID5 two disk failure offline data recovery case
Soft raid
随机推荐
JS picture hanging style photo wall JS special effect
Space game Lesson 12: shield
How to make the design of governance structure more flexible when the homogenization token is combined with NFT?
十七年运维老兵万字长文讲透优维低代码~
一个程序员的水平能差到什么程度?尼玛,都是人才呀...
平均海拔4000米!我们在世界屋脊建了一朵云
Three steps to teach you unity serial communication
[C语言刷题篇]链表运用讲解
[C language brush questions] explanation of linked list application
Redis的三种删除策略以及逐出算法
Explain rigid body and collider components in unity
How to balance security and performance in SQL?
Leetcode:2141. The longest time to run n computers at the same time [the maximum value is two points]
How do we do full link grayscale on the database?
PXE_ KS unattended system
[server data recovery] HP StorageWorks series storage RAID5 two disk failure offline data recovery case
“当你不再是程序员,很多事会脱离掌控”—— 对话全球最大独立开源公司SUSE CTO...
View the thread stack according to the lwtid of opengauss/mogdb.
How to use redis to realize things and locks?
SQL审核工具自荐Owls