Stride: Heightfield collider in Game Studio

Created on 8 Aug 2019  路  3Comments  路  Source: stride3d/stride

Is your feature request related to a problem? Please describe.
HeightfieldColliderShape can be created only at runtime.
It's not available in Game Studio and Navigation.

Describe the solution you'd like
Implement HeightfieldColliderShapeDesc like other collider shape descs.
I tried it and I think that there are some points to implement it.

  • A. What type of source should we use to initialize the heights?
    New asset or texture?

  • B. Which type of desc should it be, asset type or inline type?
    Asset type(IAssetColliderShapeDesc):
    It can use texture asset as initial heights like ConvexHullColliderShapeDesc does but can not be scaled in a scene.
    Inline type(IInlineColliderShapeDesc):
    It can be scaled in a scene but can not use texture as initial heights because to read texture at runtime needs CommandList.

  • C. How to update NavigationMeshCachedObject with updated heights?
    When heightfield's heights were updated at runtime, NavigationMeshCachedObject should be updated at rebuilding dynamic navigation mesh.
    However, NavigationMeshBuilder does not have a way to know whether or not the heights were updated.

IMHO,

  • A. Add new asset named HeightmapAsset that uses an image file as a source. (use R channel).

  • B. Inline type(IInlineColliderShapeDesc).

  • C. Add a method named Refresh to update hashcode of HeightfieldCollliderShapeDesc.
    Call it before rebuilding dynamic navigation mesh.
    This might be a temporary solution but seems to work.

Here is a branch that is based on the above.
I would like to pull-request it if the above has no problems.
I'm fine if the branch is thrown away by other ideas.

Describe alternatives you've considered
As first step, we can implement HeightfieldColliderShapeDesc without supporting initial heights and dynamic navigation mesh.

Additional context
I'm not sure that we can say "HeightfieldColliderShape is stable."
For example, I found a problem with collision between heightfield and cylinder.
Some cylinder(small? thin?) passes through the heightfield.
Using other collider shape type instead of cylinder is only way to fix it, as far as I know.
Anyway, it should be posted as new issue.

enhancement

Most helpful comment

A pull request is more likely to be looked at then an 'enhancement issue.

All 3 comments

Cool! I really hope @xen2 merge your branch! Excellent work!

A pull request is more likely to be looked at then an 'enhancement issue.

Thank you.
I will pull-request that.

Was this page helpful?
0 / 5 - 0 ratings