本文介绍了刚体物体跌落到其他物体上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个统一的刚体对象,该对象落在其他对象上.我添加了一个网格对撞机,但仍然无法正常工作.我该怎么办?
I have a rigidbody object in unity, that falls thru other objects. I added a mesh collider but it's still doesn't works. What do I need to do?
推荐答案
要使其正常运行,请确保:
To get it working, ensure that:
- 两个对象都具有对撞机(例如盒对撞机,网格对撞机或球形对撞机)
- 没有对撞机已检查
Is Trigger
- 在编辑"->项目设置"->物理"中,两个对象层在层碰撞矩阵"中未被选中
- 在代码中的任何地方都不会通过
Physics.IgnoreCollision
禁用两个对象层的碰撞 - 如果对象高速移动,则在刚体的碰撞检测"下拉列表中使用
Continuous
类型 - 所有对撞机网格都适合于您的网格过滤器的外观(它们可能具有不同的网格),例如不包含孔;启用所有小控件,以便您可以看到绿色线框中的碰撞网格的样子
- 对撞机网格的中心"或大小"未更改,以致于无法识别它们
- 没有错误消息自Unity 5以来不再支持具有非运动刚体的非凸MeshCollider";如果是,请在Mesh Collider上勾选
Convex
- 没有其他错误消息
- Both objects have a collider (like a box collider, mesh collider or sphere collider)
- No collider has
Is Trigger
checked - In Edit -> Project Settings -> Physics, the two object layers aren't unticked in the Layer Collision Matrix
- Nowhere in your code do you disable collisions of the two object layers via
Physics.IgnoreCollision
- If objects move at high speed, you use a
Continuous
type in the Rigidbody's Collision Detection dropdown - All the collider meshes are appropriate as to what your mesh filter looks like (they may have a different mesh), e.g. not contain holes; turn on all gizmos so you can see what the collision mesh looks like in green wireframe
- The collider meshes are not changed in Center or Size so as to make them missable
- There's no error message "Non-convex MeshCollider with non-kinematic Rigidbody is no longer supported since Unity 5"; tick
Convex
on the Mesh Collider if so - There's not any other error messages
祝你好运!
这篇关于刚体物体跌落到其他物体上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!