角色在玩了一段时间后掉到地上 [英] Character fall through ground after playing sometime
问题描述
我有一个带有复合碰撞器设置的角色(由许多原始碰撞器形状设置的碰撞器,每个身体部位一个),以及一个使用缩放立方体设置的简单地面.立方体在 x 轴上缩放 1000,在 z 轴上缩放 30.事情还处于早期阶段,所以没有昂贵的图形,只有原始形状和场景中的低多边形角色.开始时一切正常,但有一段时间,在我玩了一段时间后,角色开始从地上掉下来.有没有人遇到过这个问题并且知道如何解决这个问题?
I have a character with compound collider setup (the collider that is setup by many primitive collider shapes, one for each body parts), and a simple ground that is setup using a scaled cube. The cube is scaled 1000 in x and 30 in z axis. Things are still in early stage, so there is no expensive graphic, there are just primitive shapes and a low-poly character in scene. Things are going fine at begin, but for some time, after I play for a while, the character start falling through the ground. Anyone has encountered this problem and know how to fix this?
推荐答案
这里 是 SisterKy 的一个很好的可能原因的参考列表.
Here is a good reference-list of possible reasons by SisterKy.
对象有碰撞器吗?如果没有,
Does Object have a Collider? If not,
- 选择对象
- 转到顶部栏
- 组件
- 物理
- 选择合适的碰撞器(如果是地形,请检查最后一个选项卡,小齿轮)
注意:mesh-collider 可能会导致问题.
- 特别是,如果 FallingObject 和 GroundObject 都具有网格碰撞器.
- 特别是如果网格是动画的.
- 为了避免网格碰撞,您可以从几个原始碰撞器(在父级、子级或兄弟级游戏对象中)构建网格的近似形状.
- 如果你无论如何都需要一个网格碰撞器,你可以尝试在它们不会妨碍强制"碰撞的地方放置额外的原始碰撞器.
对象是触发器吗?如果是这样,
Is the Object a Trigger? If so,
- 选择对象
- 找到它的碰撞器组件(如果是地形,检查最后一个选项卡,小齿轮)
- 删除'IsTrigger'的检查
- select Object
- find its Collider-Component (if Terrain, check the last tab, the little cog-wheel)
- remove the check of 'IsTrigger'
对撞机是否放置好?摆弄中心、大小和皮肤宽度(从 0.1 开始)直到绿色轮廓大致适合角色(如果您得到非常奇怪的值,那可能是由于比例问题(例如,您的网格太大,因此您将尺寸缩小到 0.01))
Is the Collider placed well? fiddle with center, size and skin-width (start with 0.1) until the green outline aproximately fits the character (If you get really strange values, it might be due to scale (e.g. your mesh was way too big so you downsized to .01))
您可以尝试将所有定位(包括 unity 和您的建模程序)归零
You may try to zero out all positioning (both unity and your modeling-program)
- FallingObject-Collider 和 GroundObject-Collider 相互交叉.
将物体移到离地面很远的地方(为了测试目的,让它从某个相当高的高度掉下来).
所有的!不仅仅是对撞机或附加到它的其他东西(例如角色控制器的相机)
注意:戳穿(灰色胶囊"?)可能会导致问题,即使它被禁用.(我自己也不确定这意味着什么,对不起……发布此解决方案的答案不是很具体 =/)
在将对象拖入场景之前(如果已经存在则删除),
Before dragging Object into the Scene (delete if already there),
- 查看层次结构
- 找到模型
- 属性
- 选中生成碰撞器"
- 点击应用
- 现在拖到场景中
法线是否正确?你可能需要
Are the Normals correct? You may have to
- 回到你的建模程序
- 点击翻转/反向法线
网格干净吗?
据报道,单个 2 顶点三角形"导致了严重的碰撞器问题.
Is the Mesh clean?
Reportedly a single 2-vertex-"triangle" caused bad collider-issues.
几何体相当复杂?然后你需要将 Mesh-Collider 设置为凸面
Geometry is rather complex? Then you need the Mesh-Collider set to convex
- 选择对象,
- Mesh-Collider-Component
- 勾选IsConvex"
是否应用了刚体?如果没有,
Is a Rigidbody applied? If not,
- 选择下落物体
- 顶部栏
- 组件
- 物理
- 刚体
是否应用了重力?如果没有,
Is Gravity applied? If not,
- 选择下落的物体.
- 找到它的刚体组件.
- 检查重力"
有一个 MouseOrbit 吗?
And has a MouseOrbit?
确保 MouseOrbit 永远不会将 MouseOrbit 附加到的相应对象(通常是相机)的任何父对象作为 MouseOrbit 目标或由此产生的狗追逐尾巴"场景将导致坠落.http://answers.unity3d.com/questions/161386/third-person-controller-falls-through-terrain-upon.html
Make sure MouseOrbit never has/picks up any parent of the respective object that MouseOrbit is attached to (usually the Camera) as MouseOrbit-target or the resulting 'dog-chases-tail'-scenario will cause falling. http://answers.unity3d.com/questions/161386/third-person-controller-falls-through-terrain-upon.html
有传言说,Terrain Collider 可能会因为使用地形工具包资产包来制作地形而搞砸了.
Rumor has it, that Terrain Collider may be screwed up by using the terrain toolkit asset package to make the terrain.
Collisionmatrix 可能会引起麻烦.
Collisionmatrix may cause trouble.
- 转到编辑/项目设置
- 物理
- 碰撞矩阵
- FallingObject 有一个带有transform.Translate"或transform.position ="或其他各种时髦"脚本的脚本.
这可能会违背其意愿"推动对象通过对撞机.尽量避免它.(例如,使用速度"或尝试 SimpleMove)
尤其是 mac 版本在面对太多多余的废话时似乎有点问题.可能会以某种方式禁用所有碰撞器.
especially the mac-version seems to be a bit buggy when faced with too much superfluous crap. may somehow disable all colliders.
- 增加每帧的物理计算.
- 尝试捕捉对撞机的穿透(这并不能解决问题的根源).
- 从高处放下角色和默认立方体.
- 如果两者都落下,请调查地板的属性.
- 如果只有角色这样做,请调查玩家的属性.
最小化编辑器或按 alt-tab 键时会发生下降.
Falling occures when minimizing or alt-tabbing the editor.
这是一个已知问题;不要太担心,它只是在编辑器中,不会在最终构建的游戏中发生.
This is a known issue; don't worry about it too much, it's only in the Editor and won't happen in the final-built game.
请注意:我对这件事没有任何能力……只是收集我发现的东西.因此,如果您发现任何(严重?!)错误,请指出.
Please Note: I have no competence on the matter what so ever... just gathered what I found. So please point it out if you find any (severe?!) mistakes.
我的来源:
http://answers.unity3d.com/questions/39789/tornadotwinswormvideo2-帮助.html
http://answers.unity3d.com/问题/17779/character-model-sinks-through-floor.html
http://answers.unity3d.com/questions/31397/object-falls-through-floor.html
http://answers.unity3d.com/questions/31033/items-falling-through-floor.html
http://answers.unity3d.com/问题/29719/falling-through-the-floor-issue.html
http://answers.unity3d.com/questions/43206/落下地板.html
http://answers.unity3d.com/问题/35010/my-object-falls-through-terrain.html
http://answers.unity3d.com/questions/8369/whenever-i-run-my-game-i-fall-through-any-terrain.html
http://answers.unity3d.com/questions/21021/enemies-fall-through-floor-when-chasing-player.html
http://answers.unity3d.com/questions/17221/char-is-falling-through-the-terrain-when-alt-tabbi.html
http://answers.unity3d.com/questions/63750/my-characters-and-rigidbodys-fall-on-my-new-terrai.html
http://answer.unity3d.com/questions/57077/character-collider-physics-bug-in-unity-33-falling.html
http://forum.unity3d.com/threads/38996-first-person-controller-falls-through-the-terrain
这篇关于角色在玩了一段时间后掉到地上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!