79083126

Date: 2024-10-13 12:32:49
Score: 0.5
Natty:
Report link

I've figured this out. Instead of having a separate tree with expanded walls (planes) you can add hitbox size to plane distance when traversing BSP tree itself:

return Vector3.Dot(node.plane.normal, position) + (node.plane.distance + hullSize) < 0 ? IsPointInNode(position, node.frontChild) : IsPointInNode(position, node.backChild);

And if your hitbox has different sizes on different dimensions you can just multiply plane normal by hitbox size:

float hullSize = Math.Abs(node.plane.normal.X * size.X) +
                   Math.Abs(node.plane.normal.Y * size.Y) +
                   Math.Abs(node.plane.normal.Z * size.Z);
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Artyoman