-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect subtraction leading to additional fragments/paths #130
Comments
@TemperMichael I've seen issue like this before, and it's probably a floating point precision issue, but without the exact parameters it will be hard for me to reproduce or fix it. Can you provide a working code sample or project that demos it outside the context of your game? It's interesting that it is only replicable on Vision Pro - that would tend to suggest that it might be due to some compiler setting (e.g. fast math), but again it's hard for me to verify. Something that might help is calling |
I extracted the code from my app as an example project. So it shows a cube and wherever you tap it, a hole + border is placed and the latest border gets merged with the previous one if they overlap. I already had some interesting findings when I extracted the code:
I tried to comment everything a bit for better understanding. There are also two files for placing the hole - you can just comment the other one to try one of the versions:
Bonus question: I also adapted the package by making the MaterialWrapper public as I couldn't find a way to use RealityKit Materials otherwise. Could you tell me how I could use them without that adaption? Sorry if some of those issues are maybe some general knowledge when it comes to 3D modifications, it's just my very first 3D game so it's more of a trial and error workflow for me. Therefore I also already tried you |
OK, I'm able to reproduce the issue. I'll see what I can do to fix it |
Unfortunately the way that Apple has implemented RealityKit Materials makes them quite difficult to work with outside of the RealityKit framework itself. The recommended approach for now would be to use some other identifier for your materials and then replace them when you convert the Mesh to a RealityKit model at the last step. A simple approach might be to store your RealityKit materials in an Array or Dictionary and use the keys/indices as the material values in Euclid. Then when you create your ModelEntity (or whatever), there's a |
Hello, I am working on a game where you can cut holes into cubes where I add an additional mesh as a border as some kind of indicator.
If two holes overlap, I want to subtract the overlapping borders from each other, to create one big looking hole. This works in like 90% fine as you can see here:
The problem is, sometimes there appear some strange fragments - they are only visible from one side, on the back they are invisible:
Here is how I subtract them both from each other - I use a cube for the subtraction as I cutout three dimensional cubes, so when one hole is on the edge of the box, the border should be subtracted in three dimensions as well:
Here is how I create the borders: My attempt is to place a cube with the size of the hole at the position where I want to cut out the hole, scale the original box by 1.1 and use the intersection of it with the hole sized cube to cut the outer part of the border, then doing the same with a 0.9 scaled size box to cut out the inner part of the border and lastly subtracting a 0.8 hole size cube to cut out the actual hole of the border (maybe there exists a better solution to that?)
I already tried various attempts to find a solution on my side, but none of them worked, so I just wanted to make sure, that the problem is for sure on my side or if there is eventually a problem in the package?
The problem only occurs on device (Apple Vision Pro, visionOS 2.0) - I can also provide a TestFlight if this helps for debugging the issue.
The text was updated successfully, but these errors were encountered: