hello! thank you so much for your asset. I have a question, I would really appreciate it if you could help with it. for example, when I have 2 ragdoll objects on the scene, I draw a line along one of them, but they both cut, as if the line is extended and falls on the second object. is it possible to somehow modify the cut method so that by swiping at one object, the slicer cuts only the object on which the line was drawn, and not all those that fell under the continuation of the line? Thanks a lot in advance!
Hello! Having the same problem. Could you solve it?
Hi, as stated in the description, manual and this thread it is not the tools objective or purpose to check distances to objects you want to cut. How you solve this: You should do these check before invoking the cut function in your game logic.
See answer above. You have to implement this logic yourself, the āMouseBehaviourā script is just one implementation of CutterBehaviour.
Answering all your three posts with this.
-
You cannot add abstract scripts to GameObjects. This is how Unity/C# works. See Mouse/PlaneBehaviour for concrete implementations of CutterBehaviour.
-
Toggling Separate Meshes will create distinct meshes for disjoint vertice groups, i.e. triangles that are not sharing any vertices. This means if you cut a humanoid shape by the legs, both the left and right leg will belong to its own mesh and gameobject. Setting this to false will add the left and right leg to one new mesh together, which is often undesired. This is how most other Mesh Cutters on the unity asset store work and what makes this tool more applicable to games.
-
āDestroyingā original gameobject is optional and can be disabled, either by the bool exposed in the inspector, or by overriding the callback functions in CutterBehaviour to suit your needs. The new ācutā meshes will always be instantiated as new gameobjects.
- As per the manual: āThis script needs to sit on the object that holds the mesh renderer we wish to cutā
- This makes things much more complex. My advice is to separate the meshes before invoking the cut function and handling each mesh by itself.
Thanks for the helpful writeup.
Iām not sure I understand, does it or does it not work on your android device ? FYI the tool is tested and verified to run on Oculus/Meta Quest 2 which runs on Android, without issues.
Hello PBTools,
I just wanted to ask about a potential use for your asset. I have a bunch of line renderers on a 2D map, I convert them into meshes and then combine them into a single mesh, next I want to seperate the large combined mesh into seperate grid based chunks. Would this asset be able to do that? And would the resulting chunks maintain their UVs?
Thanks for your time!
hi @PBTools !
Thanks for this amazing asset. I am evaluating it right now to see how well it fits my needs and for now, I am having a blast.
One thing that bothers me a bit:
Are there any guides on mesh creation to be well cuttable?
I found that some of my meshes donāt work super well. I think it might be connected that the problematic meshes have sub-meshes. Is it possible?
The issue that I am facing is that some parts of the mesh are missing after cut and/or there are no new faces applied in places of the cut, etc.
I am wondering how to assess if mesh is a good candidate to be cut and how to improve the quality of the mesh to be better at cutting.
Hi @PBTools ,
I really appreciate this tool and it is exactly what I needed for my VR game. That being said I have a few questions I hope youāll be able to answer.
- Iād like to set it so that the created meshes do not inherit all of the components of the initial mesh. For example my object has a NavMesh Agent component on it and when I cut the animated enemy the pieces ragdoll but then roll after me since they inherited the navmesh agent component. Itās amusing if not a bit macabre but not what Iām aiming for.
- The other issue is that sometimes when cutting a mesh it duplicates and I end up with multiple of the same mesh such as 2 heads or torsos. I selected the Destroy bool so it should be deleting the original but it still occurs on occasion.
- The last issue might be something I messed up when setting up the ragdoll but on mesh cut the top half always separates from the lower half even if I only cut the head off. Torso and legs tear apart at the waist and the feet separate from the legs.
Thanks and hope to her back soon.
Hello and thank you for this wonderful useful tool. Could I cut a regally animated 3D character while in usual motions?
it seems webgl doesnāt support multithreading
Yes, it should and UVs remain the same but keep and eye on the vertex/polygon amount when combining many smaller meshes together. Performance will decrease with increasing amounts.
Hi @nehvaleem this is indeed a good question, but I havenāt created any guides for this kind of thing.
Generally I only recommend cutting single meshes that are not too complex and have a low poly count.
Cutting anything with multiple submeshes or worse a mesh with other meshes as children will result in unwanted results.
This is because the tool only considers one target mesh that the user specifies. If you want to cut more complex meshes you should either unparent meshes in runtime, or work on simplifying your meshes in 3d modelling software.
Generally there should be no issues with cutting single meshes, except for inner holes or meshes that are poorly modelled, i.e. have floating or unjoint vertices.
I donāt understand what āregallyā means but as per description/manual animated, skinned objects/meshes can be cut with this tool
Hello @PBTools !
I recently just got this, and I really like how it works. Iām having one pretty big issue with it at the moment, however. I was testing it out in the example scene included with the package with no modifications whatsoever, and after maybe five or so slices using the MouseBehavior script, I get giant amounts of CPU usage continuously afterwards. Even after the slice is performed, the usage stays consistently high. Iāve gotten it to occur with the PlaneBehavior script as well. Whenever the script component is disabled or destroyed, the usage is removed. It also only occurs when async is enabled. Iāve tried in both 2021 and 2022 versions. I am using URP at the moment, but using the built in pipeline changes nothing (I tried that for the 2021 test).
Is the practice of destroying the behavior after cutting encouraged, or is this some sort of bug? I assume itās a threading issue of some sort, but Iām not knowledgeable at all in that category.
Again, Iām loving it! Iām hoping I can continue using is with async turned on too
Follow up here,
I was messing around in the code, and I noticed that the Queue called _queue in AsycWorker can obtain a negative count. I think it might be through a race condition based on very limited Google searching, but I added a check under the null task check to see if the count is negative and clear the queue then if necessary.
CODE FOR: AsycWorker
try
{
CuttingTask task = _queue.Dequeue();
if (task == null)
{
int queueCount = _queue.Count;
if(queueCount < 0)
{
_queue.Clear();
}
continue;
}
task.Callback(task.Arg);
}
catch (InvalidOperationException e)
{
Debug.LogWarning(e);
}
This is definitely not the best solution, but I have confirmed that this removes the CPU usage problem. Itās definitely linked to the negative count causing a pseudo while(true) loop in the code.
Thank you very much @EPCubed for the detailed description of this edge case. I do remember running into a similar problem a long time ago but I couldnāt reproduce it and didnāt get around to fix it.
I will look into this ASAP and release a patch if I can fix the issue.
Is the practice of destroying the behavior after cutting encouraged, or is this some sort of bug?
Regarding this, if I understand correctly, are you referring to the original Gameobject? Since two (or more) new Gameobjects are created after the cut, the old Gameobject is no longer needed and therefore I destroy it by default. If you donāt do this, you will effectively have multiple objects overlap each other since the new objects are spawned in exactly the same space as the old one, which can cause issues if youāre working with colliders. Of course this behaviour can easily be overwritten if you donāt want to do this.
Thanks again and I will get back to you when I have news.
@EPCubed I have fixed the unsafe access of _queue.Count as follows:
CuttingTask task = null;
lock (_queueLock)
{
if(_queue.Count > 0)
{
task = _queue.Dequeue();
}
}
if(task == null)
{
_autoReset.WaitOne();
continue;
}
Now the access to _queue.Count should be thread safe there should be no more issue.
Look out for version 1.2.5 which should hopefully be approved and released to the Asset Store soon. I also added a feature that allows you to manually set the amount of threads being used, for users who want more control over this.