惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - Franky
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
A
About on SuperTechFans
博客园 - 【当耐特】
Microsoft Security Blog
Microsoft Security Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The GitHub Blog
The GitHub Blog
雷峰网
雷峰网
博客园_首页
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
IT之家
IT之家
博客园 - 叶小钗
Google DeepMind News
Google DeepMind News
aimingoo的专栏
aimingoo的专栏
博客园 - 聂微东
B
Blog RSS Feed
H
Help Net Security
Recent Announcements
Recent Announcements
阮一峰的网络日志
阮一峰的网络日志
D
DataBreaches.Net
L
LangChain Blog
Vercel News
Vercel News

博客园 - Stanley.Luo

CentOS 7+nginx+PHP+php-fpm Linux 的系统目录介绍 C++与Java,C#的异同(一):值,地址,引用 Loom工具类:Unity3D巧妙处理多线程 3Dmax 创建物体 3DMax 物体选择方法 3DMax 常用快捷键 HTC Vive 与Leap Motion 出现位置错误的问题 Groovy与Gradle在Android中的应用 VR的UI、UX设计原则 Mecanim动画模型规范 Mecanim动画系统 制作流程 HTC Vive 体验的折腾经历 OpenGLES 2.0 可编程渲染管线 【VR视频播放】解决Unity模型贴图反转的问题 Lua语言的特别之处 Unity3D 的摄像机 iptables 的使用 CentOS安装Nginx
为什么带网格(mesh)的模型添加了刚体Rigidbody和MeshCollid...
Stanley.Luo · 2016-07-17 · via 博客园 - Stanley.Luo

 两个Gameobject 放置在空中, 一个是Cube,一个是茄子模型

Cube的Collider 是Box Collider , 茄汁的Collider 是mesh collider, 他们都添加了刚体(RigidBody)组件, 勾选了重力Gravity

但是, 运行的结果是:

正方块Cube下落, 掉到地面上停了下来

茄子下落,没有停下来, 穿透了地面,一直往下掉。

百事不得其解。。。

终于还是在官方文档中看到这段话:

There are some limitations when using the Mesh Collider. Usually, two Mesh Colliders cannot collide with each other. All Mesh Colliders can collide with any primitive Collider. If your mesh is marked as Convex, then it can collide with other Mesh Colliders.

使用网格碰撞器有一些限制条件。通常,两个网格碰撞器之间不会发生碰撞。所有的网格碰撞器可以和任何原型碰撞器碰撞。如果网格标记为凸起的(Convex),那么就可以和其他网格碰撞器碰撞。

试了一下, 把茄子Mesh Collider的Convex 勾上,

 

OK了, 停下来了!

还有一下注意事项:

http://www.ceeger.com/Components/class-MeshCollider.html

Hints 提示

    • Mesh Colliders cannot collide with each other unless they are marked as Convex. Therefore, they are most useful for background objects like environment geometry. 
      除非被标记为凸起的(Convex),否则网格碰撞器间不会发生碰撞。因此,它们最常被用于背景对象比如环境布景。
    • Convex Mesh Colliders must be fewer than 255 triangles. 
      凸起的网格碰撞器含有的三角形面不能多于255个。
    • Primitive Colliders are less costly for objects under physics control. 
      原型控制器对于对象的物理控制更加节省资源。
    • When you attach a Mesh Collider to a GameObject, its Mesh property will default to the mesh being rendered. You can change that by assigning a different Mesh. 
      当为游戏对象附加了网格碰撞器,其网格属性将被定义为用于渲染的网格,可以通过指派其他网格来改变。
    • To add multiple Colliders for an object, create child GameObjects and attach a Collider to each one. This allows each Collider to be manipulated independently. 
      要给一个对象添加多个碰撞器,应该创建子对象并给每个子对象添加一个碰撞器。这使每个碰撞器可以被单独操作。
    • You can look at the gizmos in the Scene View to see how the Collider is being calculated on your object. 
      可以通过场景视图(Scene View )中的线框(gizmos)来查看碰撞器在你的对象上的预期效果。
    • Colliders do their best to match the scale of an object. If you have a non-uniform scale (a scale which is different in each direction), only the Mesh Collider can match completely. 
      碰撞器尽量匹配对象的比例。如果有一组不规则伸缩(每一维度上的比例都不相同),只能使用网格碰撞器才能完全匹配。
    • If you are moving an object through its Transform component but you want to receive Collision/Trigger messages, you must attach a Rigidbody to the object that is moving. 
      如果你想接收通过Transform组件移动的对象的碰撞/触发信息,你必须给移动对象附件刚体。