為什麼帶網格(mesh)的模型添加了剛體Rigidbody和MeshCollider,還是會從地板穿過去?

來源:互聯網
上載者:User

標籤:

 兩個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組件移動的對象的碰撞/觸發資訊,你必須給移動對象附件剛體。

 

為什麼帶網格(mesh)的模型添加了剛體Rigidbody和MeshCollider,還是會從地板穿過去?

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.