Hello, I’ve hit a wall trying to figure out a clean way to compare directions between local and world rotation. If it was simply comparing the rotation of an object against the world that would be easy enough, I’m sure I could get that functioning even if not the most optimal way. The issue I’m having is because there is no transform to work from, only a rotation.
A quick overview, what I’m making is a voxel builder, data for each index is defined in a custom Block class. I’m currently working on a connection system so that I can have blocks that are completely detached treated correctly and have them “break off” etc (eventually I want to have destruction and a damage system). The problem I have is that not everything I want implemented is a 1x1 cube that connects on all sides. I have, for example, a prism/sloped block which only connects on 4 sides, and other structural blocks such as doorways which are a complex volume that have connecting faces spread over multiple array indices & in various directions. On top of this, things can be rotated to 90 degree angles around any axis, and so need to correctly convert any connecting face from the local rotation to world space in the voxel grid.
I’m at a complete loss as to how I can take a direction from a local rotation and cleanly assign it to a correct global axis. When a new Block is initialised the constructor is fed the block type (enum), position (vector3), and rotation (quaternion) and derives everything about the Block from that, as things stand I have 6 booleans for connections in each direction that can be set per Block (I realise there are much cleaner ways to do this, storing the booleans within a byte and doing bitwise operations, for example, I just don’t know enough to implement it) and had planned on somehow including a reference to any “connectable nodes” (child indices of the Block, if you will) for larger objects that take the space of multiple blocks.
Hoping someone might be able to point me in the right direction as I’m truly stuck, I’ve been bashing my head against this brick wall for over a week now and it’s really beginning to drain my enthusiasm and confidence.