3 ms·
The engine simply divides the space into parts to decrease the number of checks necessary. It doesn't constrain you in any way regarding to what shapes you want
by don_shadaman 4y ago
The engine simply divides the space into parts to decrease the number of checks necessary. It doesn't constrain you in any way regarding to what shapes you want to insert, however the broad "hitbox" must be a hypercube, and later on you can do your own math to inspect if in fact your "real" hitboxes are in contact. It doesn't matter if your shapes are convex or not, the engine sees them all as hypercubes, so all you need is provide one that's equal to or larger than your model.
This has it's downsides, namely that for very slim yet long objects you will have a pretty big hitbox, but I wouldn't worry about it that much, since the collision detection step is done really quickly. Or, you can always insert multiple smaller hypercubes to ease it up a little bit, but then you need to be vary of duplicate collisions.
If you really want, I can extend the existing codebase to also include 4D. I hope I will be able to correctly deduce the 4D cells that need to be checked for collision haha, I think nobody is good at visualising 4D very well.
As for the math equation for the shape you are looking for, I'm not a 4D guru, so I can't help you with that, sorry. I tried some research just now, but this just isn't for me.