Unity的网格碰撞器与其他对象不发生碰撞,2D游戏

huangapple go评论66阅读模式
英文:

Unity mesh collider isn't colliding with other objects, 2D game

问题

我已经从Blender中的SVG创建了一个网格并将其转换为网格。然后我将其放入Unity中,以便在上面放置一个碰撞器,但是网格与任何东西都没有碰撞,即使选中了凸形。

这是我的碰撞器:

Unity的网格碰撞器与其他对象不发生碰撞,2D游戏

这是在Blender中的我的网格(蓝色是网格的外部):

Unity的网格碰撞器与其他对象不发生碰撞,2D游戏

凸形碰撞器的样子:

Unity的网格碰撞器与其他对象不发生碰撞,2D游戏

有人能告诉我为什么碰撞器不起作用吗?
谢谢!

英文:

I've made a mesh from an SVG in Blender and converted it to a mesh. I then put it into Unity, to put a collider on it, the mesh does not collide with anything, even with convex ticked.

Here is my collider:

Unity的网格碰撞器与其他对象不发生碰撞,2D游戏

And here is my mesh in Blender (blue is the outside of the mesh):

Unity的网格碰撞器与其他对象不发生碰撞,2D游戏

What the convex collider looks like:

Unity的网格碰撞器与其他对象不发生碰撞,2D游戏

Can someone tell me why the collider is not working?
Cheers!

答案1

得分: 2

MeshCollider 是在3D物理引擎中实现的,因此与2D物理引擎不兼容。它们根本不互动。

您可能想要使用的是PolygonCollider2D

英文:

The MeshCollider is implemented in the 3D Physics engine and therefore incompatible with the 2D Physics engine. They simply don't interact.

What you probably want to use instead is the PolygonCollider2D

答案2

得分: 0

当使用碰撞器和2D时,请确保您具有以下内容:

  • RigidBody2D
  • Collider2D

此外,Mesh Collider 是3D 实现。如果您想要2D 中等效的 Mesh Collider,请改用 Polygon Collider 2D

英文:

When working with Colliders and 2D, make sure you have the following:

  • RigidBody2D
  • Collider2D

In addition a Mesh Collider is a 3D implementation. If you want the 2D equivalent of a Mesh Collider in 2D, use a Polygon Collider 2D instead.

huangapple
  • 本文由 发表于 2023年1月9日 10:26:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/75052677.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定