So I am trying to think of good solution to this. One solution is that I could do collision checking against the current cell and the cell in which the movement vector ends. I think that would work. In this specific case I would have to actually create a cell and define some walls (because the movement vector ends in a place where no cell actually exists in this specific case).
DavidP:
You really must check every cell that the movement vector crosses, not just the cell that the end point resides in.
Here's some BSP code that finds the 'cells' that a movement vector passes through. While your implementation will be slightly different, due to the fact that you have real cells all of the same dimensions, this should give you the right idea.
Code:
void MoveTouchNode(BSP*pBSP,int node, Vector3 *Start,Vector3 *End,float Radius, std::vector<int> &TouchedLeafs)
{
if(node < 0)
{
TouchedLeafs.push_back(~node);
return;
}
//Find starting point distance to plane
tBSPNode *pNode = &pBSP->mpNodes[node];
tBSPPlane *pPlane = &pBSP->mpPlanes[ pNode->plane ];
Vector3 *pNormal= &pPlane->vNormal;
float StartD = DotProduct(Start,pNormal) - pPlane->d;
float EndD = DotProduct(End,pNormal) - pPlane->d;
if(StartD >= Radius && EndD >= Radius) //should be 0, not 10, enlarged for tolerances
{
MoveTouchNode(pBSP,pNode->front,Start,End,Radius,TouchedLeafs);
return;
}
if(StartD < -Radius && EndD < -Radius)
{
MoveTouchNode(pBSP,pNode->back,Start,End,Radius,TouchedLeafs);
return;
}
MoveTouchNode(pBSP,pNode->front,Start,End,Radius,TouchedLeafs);
MoveTouchNode(pBSP,pNode->back,Start,End,Radius,TouchedLeafs);
}