Skip to content

Commit 137215c

Browse files
committed
physics: fix VHACD Bepu hull crash from passing index count as triangle count
1 parent e09946a commit 137215c

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

sources/engine/Stride.Assets/BepuPhysics/HullAssetCompiler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ protected override Task<ResultStatus> DoCommandOverride(ICommandContext commandC
225225
var decompositionDesc = new ConvexHullMesh.DecompositionDesc
226226
{
227227
VertexCount = (uint)combinedVerts.Count / 3,
228-
IndicesCount = (uint)combinedIndices.Count,
228+
TriangleCount = (uint)combinedIndices.Count / 3,
229229
Vertexes = combinedVerts.ToArray(),
230230
Indices = combinedIndices.ToArray(),
231231
SimpleHull = !Parameters.Decomposition.Enabled,

sources/engine/Stride.Assets/Physics/ColliderShapeAssetCompiler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ from shape in Parameters.ColliderShapes
289289
var decompositionDesc = new ConvexHullMesh.DecompositionDesc
290290
{
291291
VertexCount = (uint)combinedVerts.Count / 3,
292-
IndicesCount = (uint)combinedIndices.Count / 3,
292+
TriangleCount = (uint)combinedIndices.Count / 3,
293293
Vertexes = combinedVerts.ToArray(),
294294
Indices = combinedIndices.ToArray(),
295295
SimpleHull = !convexHullDesc.Decomposition.Enabled,

sources/engine/Stride.Assets/Physics/VHACDSharp.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ internal sealed class ConvexHullMesh : IDisposable
1616
public struct DecompositionDesc
1717
{
1818
public uint VertexCount;
19-
public uint IndicesCount;
19+
public uint TriangleCount;
2020
public float[] Vertexes;
2121
public uint[] Indices;
2222

@@ -43,7 +43,7 @@ public void Generate(DecompositionDesc desc)
4343
{
4444
_internalCompound = vhacdGenerate(
4545
desc.Vertexes, desc.VertexCount,
46-
desc.Indices, desc.IndicesCount,
46+
desc.Indices, desc.TriangleCount,
4747
desc.SimpleHull,
4848
desc.MaxConvexHulls,
4949
desc.Resolution,

0 commit comments

Comments
 (0)