Closed PolSpock closed 1 year ago
In the rewrite I'm not stitching together vertices from the cut faces and the front / back faces. Doing it in a nice way will be tricky, but I'll have a try soon.
Sorry for the long wait, this should be sufficient for what you're doing now. There might still be some vertices that are almost identical, but the collision mesh should be properly connected now.
Feel free to comment / reopen if it's still an issue for you.
Describe the bug
Hello,
I've updated my SDF library for getting the 2D rework, however my "shard system" has started to bug. (cause i'm navigating on Indices)
After investigation, i've found that
WriteCollisionMesh()
is creating too many indices instead of reusing them for the same VertexThe old system (before the rework in lately July) was working well
To Reproduce
1) Go to your
Sdf2DMeshWriter.cs
file andprivate void WriteCollisionMesh( Sdf2DLayer layer )
function 2) Add this piece of debug :3) Now create a
Sdf2DWorld
. Personally, i have edited the BlobTool 4) Spawn a 2D surfaceSdfWorld.AddAsync( new RectSdf( new Vector2( -58, -58 ), new Vector2( 58, 58 ) ), Default2DVolume )
5) Start a game and spawn the Sdf2DWorld : you will have many duplicate indices referring to the same VertexWhereas if you using a old version of the SDF Library (like this one https://github.com/Facepunch/sbox-sdf/tree/1b833630142e34110e9e46bdc4ba3cbe50da3a6c), you have to add the same debug in
public void Write( Sdf2DArrayData data, Sdf2DLayer layer, bool renderMesh, bool collisionMesh )
function ofSdf2DMeshWriter.cs
And you will have no duplicate extra indices for the same Vertex
Expected behavior
Only one indice must refer to a vertex.
I have tried to fix it myself but have not been able yet.
Regards