Well, I just spent about half an hour typing an update to this, and then when I went to Upload Attachment to upload a script and clicked "Add the file", it took me back to the forum login screen since I had timed out due to inactivity. I've had the same issue happen when typing up a long forum post, so I've gotten used to copying all of my text before hitting Submit (so I can then Paste it back in after re-logging in), but I didn't realize uploading the attachment would also have caused that. 😢 I've lost multiple hours worth of typing/organizing posts on this forum in the past - I'm not sure if the inactivity timeout duration should be extended, or if there is some way to detect that you're actively still creating/typing the post while you're creating it (so you don't timeout), but it would be really good if something was done to alleviate that issue. Maybe auto-saving drafts?
Anyway, on to the topic:
I've been wanting to update this post for a while, but there are some kinks/issues that I haven't sorted out yet, and my code has some project-specific stuff in it and isn't very presentable. But I saw that someone else posted asking about doing a similar thing, so I figured I could at least post what I have in case anyone wants to look through it and try it out.
Definitely check out the info in the Unity forum posts that I linked when originally posting this.
I've attached DeformableBoundingBoxFollower.cs which is based on BoundingBoxFollower.cs.
You will need to set up the Ear Clipping algorithm -
I created it from info from this website: https://www.codeproject.com/Articles/8238/Polygon-Triangulation-in-C
Here is a UnityPackage for my scripts for this algorithm: https://drive.google.com/file/d/1bxO_GP_sCESk15pbyuXnRg6CfePc8jm3/view?usp=sharing
Tessellation algorithm was from here: https://github.com/speps/LibTessDotNet
You will need to download it and add it to your project (if you want to use Tessellation).
Important note: If you just want to use the "Max 8-Sided Convex Polygon" option, then you could probably just use the DeformableBoundingBoxFollower.cs script and strip out anything related to the Ear Clipping / Tessellation algorithms. Might be pretty straightforward if you only needed that.
What works:
-I am only using the "Max 8-Sided Convex Polygon" (what I call "Direct From Convex Polygon" in the script). It seems to be working well, except for one thing (noted below).
Issues:
-I believe there is an issue where OnTriggerEnter2D is called every frame that these collider-triggers are overlapping another collider. My usage of this (hitboxes) handles it fine, but it could definitely be a problem for other implementations. I had specifically asked MelvMay on the Unity forum posts about this (making sure that OnEnter/OnExit would be called correctly), and he said that it should act the same way as any other collider would work. So there may be something wrong with my usage, or maybe there is a bug. Haven't had the time to look into it.
-When I try to use the Ear Clipping and the Tessellation algorithms have an issue where, when I call customCollider.SetCustomShapes(shapeGroup); it has an error where it thinks that the number of Vertices has changed. I am not sure why - if I print the number of vertices for the ShapeGroup before and after the error, it is the same number. The number of shapes also are the same. The algorithms themselves seem to work fine - they generate the polygon correctly.
-The first time you use Tessellation there is a big lag-spike (anywhere from 0.5s to 1.5s for me). After that it is much faster. I'm guessing there is some initialization done the first time you use it, so if anyone ends up using Tessellation you could probably initialize it somehow when you first start up the game.