Skip to content

Update to v-hacd 4.1#16

Open
joaomacp wants to merge 8 commits intoUnity-Technologies:devfrom
joaomacp:update-vhacd-4-1
Open

Update to v-hacd 4.1#16
joaomacp wants to merge 8 commits intoUnity-Technologies:devfrom
joaomacp:update-vhacd-4-1

Conversation

@joaomacp
Copy link

@joaomacp joaomacp commented Sep 29, 2023

Proposed change(s)

Update to the latest kmammou/v-hacd.

v-hacd version 4 changed to being a single-header file, including both function signatures and implementation code. This was copied to src/inc/VHACD.h.

src/dll has the updated dll.cpp. The biggest difference was to define our own ConvexHull struct. Since the new version changed IVHACD::ConvexHull to use std::vector and nested objects (e.g. std::vector<VHACD::Vertex>), I made a simpler struct ConvexHullCSharp with pointers and lengths to the points and triangles. This makes it easier to interop with C#.

This does mean I'm copying the IVHACD::ConvexHulls into ConvexHullCSharp structs (I did take care of deallocating the memory used by this after it's consumed). But this step is not a bottleneck for generation-performance -- the actual hull generation is where almost all of the time is spent, and that still happens on the C++ side only.

I've also updated VHACD.cs to match the new Parameters, and free the memory allocated by the copying explained above. There are tooltips for all the params:

Screenshot from 2023-09-29 12-43-38

I've updated the CMake setup to have only one CMakeLists.txt to build the shared libraries.

Finally, I've deleted src/test, bin, and bin_no_ocl, as they're not needed in this package.

Useful links (GitHub issues, JIRA tickets, forum threads, etc.)

Types of change(s)

  • Bug fix
  • New feature
  • Code refactor
  • Documentation update
  • Other (please describe)

Update dependency.

Testing and Verification

Please describe the tests that you ran to verify your changes. Please also provide instructions and Unity project files as appropriate so we can reproduce the test environment.

Test Configuration:

  • Unity Version: Unity 2022.3.10f1
  • Unity machine OS + version: Windows 10, Ubuntu 22.04.3 (didn't test the .dylib on Mac, but it builds with the same CMake config, so I assume it works as it did before)

Checklist

  • Ensured this PR is up-to-date with the dev branch
  • Created this PR to target the dev branch
  • Updated the Changelog and described changes in the Unreleased section
  • Updated the documentation as appropriate

Other comments

@joaomacp joaomacp force-pushed the update-vhacd-4-1 branch 2 times, most recently from 79ab94d to cdc8db7 Compare September 29, 2023 17:02
@joaomacp joaomacp changed the base branch from main to dev September 29, 2023 17:40
@joaomacp joaomacp marked this pull request as ready for review September 29, 2023 17:56
@usirg
Copy link

usirg commented Oct 1, 2023

much appreciated! I hope someone at Unity will review this quickly!

@ByteSz
Copy link

ByteSz commented Apr 4, 2024

Would love to see this potentially get some love and support! Would really help to have V-HACD collision meshes be available with mesh colliders as full package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants