This week was about testing the puzzle API with the Vive. The lead producer, designer and programmer wanted the API working last week. The API was inside the game but it couldn't be tested because of existing issues in the game. The grabbing mechanic and level loading was not working properly.
Once the hands and level issues were fixed the API was tested. It was initing and updating the puzzles but wasn't calling the collision function. The lead programmer told me to change it so that the API will just check to see if two objects are inside each other. Right now the API is using IsOverlappingActor() to check if two actors are overlapping. Once that was changed, the API was tested and the game crashed. So we have to fix this asap.
We know where it crashes, it crashes when it goes into the function that checks to see if two objects are overlapping. So the reasons that it is crashing is either: IsOverlappingActor() is messing up for some reason, the arrays are going out of bounce, or it's deleting an object that doesn't exist.
//breaks in update somewhere
for( i = mp_start.Num() - 1; i >= 0; --i)
{
for(int j = 0; j < mp_end.Num(); j++)
{
//should break here
if(mp_end[j]->IsOverlappingActor(mp_start[i]))
{
UE_LOG(LogTemp, Warning, TEXT(In collision!\n"));
if(mp_OtherObject.Num() >0)
{
mp_start[i]->SetActorHiddenInGame(true);
mp_OtherObject[mp_OtherObject.Num() - 1]->SetActorHiddenInGame(false);
delete mp_start[i];
//actually breaks right here, i could be out of index should be
//delete mp_OtherObject[mp_OtherObject.Num() - 1];
//not
delete mp_OtherObject[i];
mp_OtherObject.RemoveAt(mp_OtherObject.Num() - 1, 1);
mp_start.RemoveAt(i, 1);
}
else
{
delete mp_start[i];
mp_start.RemoveAt(i, 1);
}
}
//should break abouve here
}
}