THe code below stops the camera getting hidden behind walls in a 3rd person game.Its from an aggror c++ tutorial and works fine with walls. The problem comes in hilly terrain where it thinks a hill is a wall and makes my character disappear and re appear all the time.
Anyoe help???
EDIT thegame is ok without this code. but I just wondered.
PickInfo pick;
if (world->Pick(fpsPivot->GetPosition(), tpsPivot->GetPosition(), pick, 0, true))
{
//Store distance
float distance = fpsPivot->GetPosition().DistanceToPoint(pick.position);
printf((String(distance) + "\n").c_str());
//If the tps distance is to small, we switch to FPS view
if (distance < minCamOffset)
{
camera->SetPosition(fpsPivot->GetPosition());
}
else
{
camera->SetPosition(pick.position);
}
}
else
{
camera->SetPosition(tpsPivot->GetPosition());
/