- Home /
Defining which faces of a voxel are "connectable"
Hello. I've been playing around making a voxel builder of sorts, essentially I'm looking to implement a system where said voxels have a "connection system".
What I was thinking was to use an enum for "connectable faces" and then somehow assign which faces are connectable using that. Settings aside for a moment that I would need all permutations of up/down/left/right/back/front within this enum, what I'm really unsure of is how I deal with checking whether a voxel should connect "right", for example, when the enum might well indicate multiple connecting faces.
Say a regular cube has connected faces "UDLRFB", how do I then check whether it contains an "R" connection? Surely there must be a better way to do it than to analyse the enum as a string?
Assuming that the above is possible I then also have a better way to implement face culling, too. As an aside, while this is fairly simple for single-voxel sized objects I also have larger, non-cube shaped objects that fit within the voxel array, I have absolutely no idea how I would indicate (within the constructor, I assume?) which array locations would be "children" of a certain "root" voxel index, and also how I would assign the connectable faces of these "child" indices.
Your answer
![](https://koobas.hobune.stream/wayback/20220612230136im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Put an enumerable inside another enumerable (js) 0 Answers
null reference exception problem with generic lists in unityscript (i think...) 1 Answer
How do I create a bunch of player abilities, with their own properties? 2 Answers
How to make subclass variables appear in inspector with enum 1 Answer
Help integrating a category system 0 Answers