Collisions
Hello eveyone,
I am having some problems on my project about collisions. I have some aparments in my game and my shipmodel now. I want to add some collisions for my model and for buildings. If I go out from my city or try to go through the buildings, I would like to re-start my ship from the beginning.
Any help would be appreciated.
Many Thanks.
I have tried to use something similar to this for prevent the ship going out from the city but it's not working either.
private void SetUpBoundingBoxes()
{
int cityWidth = floorPlan.GetLength(0);
int cityLength = floorPlan.GetLength(1);
List<BoundingBox>
bbList = new List<BoundingBox>
(); for (int x = 0; x < cityWidth; x++)
{
for (int z = 0; z < cityLength; z++)
{
int buildingType = floorPlan[x, z];
if (buildingType != 0)
{
int buildingHeight = buildingHeights[buildingType];
Vector3[] buildingPoints = new Vector3[2];
buildingPoints[0] = new Vector3(x, 0, -z);
buildingPoints[1] = new Vector3(x + 1, buildingHeight, -z - 1);
BoundingBox buildingBox = BoundingBox.CreateFromPoints(buildingPoints);
bbList.Add(buildingBox);
}
}
}
buildingBoundingBoxes= bbList.ToArray();
}
Comments
Feel free to leave a comment...
and oh, if you want a pic to show with your comment, go get a gravatar!










