2021-01-07 12:26 阅读 1

Mesh Collider Shape

Currently there isn't any method in Xenko for handling collisions with low-poly organic world geometry, like those prominently seen in many great NPR games. (The Legend of Zelda and Mario series, and most indie Unity games).

For example a map like Outset Island from Legend of Zelda: Wind Waker HD would be impossible to accurately map collision to its geometry using any of the the provided collider shapes as there isn't a way to adjust its vertices to conform to the target mesh.


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

7条回答 默认 最新

  • weixin_39575212 weixin_39575212 2021-01-07 12:26

    You can generate a convex hull from a low-poly version of your geometry and use it as a collider shape. https://doc.xenko.com/latest/en/manual/physics/collider-shapes.html#create-a-collider-shape-asset-from-a-model

    Editing the collider is not supported at the moment in the editor, but the API should allow you to do it from code (although I personally don't know exactly how).

    点赞 评论 复制链接分享
  • weixin_39799307 weixin_39799307 2021-01-07 12:26


    I wouldn't exactly call this usable...

    点赞 评论 复制链接分享
  • weixin_39575212 weixin_39575212 2021-01-07 12:26

    In your case, a convex hull is obviously not the right shape. But as the documentation mentions, you can use a lower poly version of your model as a collider shape. https://doc.xenko.com/latest/en/manual/physics/collider-shapes.html#use-a-collider-shape-asset

    点赞 评论 复制链接分享
  • weixin_39553776 weixin_39553776 2021-01-07 12:26

    But this still creates a convex hull from the asset correct? A convex hull generated from a from an asset makes it difficult to do closed in geometry like a tube, cave or a building. You would have to piece it together.

    Piecing together a complex collider shape from boxes is what is done in the Third Person Platformer demo. There is no mesh collider that I have found. Unless there is some other way to do it other than piecing it together?


    点赞 评论 复制链接分享
  • weixin_39553776 weixin_39553776 2021-01-07 12:26


    点赞 评论 复制链接分享
  • weixin_39965283 weixin_39965283 2021-01-07 12:26


    Xenko has the feature that generates multiple convex hulls from a model. I heard it is disabled because computing it will take a lot of time.

    If SimpleWrap = false, it is enabled. Directly edit the asset file with a text editor to be enabled it. Or edit and build the source code to exposing some properties.


    点赞 评论 复制链接分享
  • weixin_39820177 weixin_39820177 2021-01-07 12:26

    Thanks, good find!

    If it works, let's expose it. We probably have to do a few adjustments: - SimpleWrap is not very easy to understand, we should probably rename it - It seems there is a bunch of other parameters to expose (maybe they should be visible only when VHACD mode is enabled) Typical way to do that is to create several types sharing a common class/interface. For example, IConvexHullGenerator (one implementation for convex hull, one impl for VHACD with VHACD-specific parameters). Then we add this common class/inteface in the ConvexHullColliderShapeDesc. If we do this, this will replace SimpleWrap parameter. - our VHACD lib is probably old, it might be a good idea at some point (can be done later)

    点赞 评论 复制链接分享