void CMinotaurSpawn::AddColliders() { for (size_t currMesh = 0; currMesh < meshes.size(); currMesh++) { CMesh* mesh = meshes[currMesh]; XMFLOAT3 posOffset = XMFLOAT3(meshLocalMatricies[currMesh]._41, meshLocalMatricies[currMesh]._42, meshLocalMatricies[currMesh]._43); int startIndex = 0; if (mesh->IsPlane()) { int index = 0; for (index = 0; index < (int)mesh->GetAABBs().size(); index++) { CMesh::TAABB aabb = mesh->GetAABBs()[index]; aabb.center.x += posOffset.x; aabb.center.y += posOffset.y; aabb.center.z += posOffset.z; AddCollider(new CCollider(false, new CAABB(aabb.center, aabb.extents))); } index = 0; if (m_pvColliders[0]->GetType() == Bounds::Plane) index = 1; for (index; index < mesh->GetPlanes().size(); index++) { CMesh::TPlane plane = mesh->GetPlanes()[index]; plane.center.x += posOffset.x; plane.center.y += posOffset.y; plane.center.z += posOffset.z; AddCollider(new CCollider(false, new CPlane(plane.distance, plane.normal, plane.center, plane.extents))); } } else { int index = 0; if (m_pvColliders[0]->GetType() == Bounds::AABB) index = 1; for (index; index < mesh->GetAABBs().size(); index++) { CMesh::TAABB aabb = mesh->GetAABBs()[index]; aabb.center.x += posOffset.x; aabb.center.y += posOffset.y; aabb.center.z += posOffset.z; AddCollider(new CCollider(false, new CAABB(aabb.center, aabb.extents))); } for (index = 0; index < mesh->GetPlanes().size(); index++) { CMesh::TPlane plane = mesh->GetPlanes()[index]; plane.center.x += posOffset.x; plane.center.y += posOffset.y; plane.center.z += posOffset.z; AddCollider(new CCollider(false, new CPlane(plane.distance, plane.normal, plane.center, plane.extents))); } } } }
void CPrefabObject::AddColliders() { for (size_t currMesh = 0; currMesh < meshes.size(); currMesh++) { CMesh* mesh = meshes[currMesh]; int startIndex = 0; if (mesh->IsPlane() ) { int index = 0; for (index = 0; index < (int)mesh->GetAABBs().size(); index++) { CMesh::TAABB aabb = mesh->GetAABBs()[index]; if (m_szTag == "SafeHaven" && (aabb.extents.x == 500.0f && aabb.extents.y == 300.0f && aabb.extents.z == 500.0f)) AddCollider(new CCollider(false, new CAABB(aabb.center, aabb.extents), true, false)); else AddCollider(new CCollider(false, new CAABB(aabb.center, aabb.extents))); } index = 0; if (m_pvColliders[0]->GetType() == Bounds::Plane) index = 1; for (index; index < mesh->GetPlanes().size(); index++) { CMesh::TPlane plane = mesh->GetPlanes()[index]; AddCollider(new CCollider(false, new CPlane(plane.distance, plane.normal, plane.center, plane.extents))); } } else { int index = 0; if (m_pvColliders[0]->GetType() == Bounds::AABB) index = 1; for (index; index < mesh->GetAABBs().size(); index++) { CMesh::TAABB aabb = mesh->GetAABBs()[index]; if (m_szTag == "SafeHaven" && (aabb.extents.x == 500.0f && aabb.extents.y == 300.0f && aabb.extents.z == 500.0f)) AddCollider(new CCollider(false, new CAABB(aabb.center, aabb.extents), true, false)); else AddCollider(new CCollider(false, new CAABB(aabb.center, aabb.extents))); } for (index = 0; index < mesh->GetPlanes().size(); index++) { CMesh::TPlane plane = mesh->GetPlanes()[index]; if (m_szTag == "SmallPit") { if (plane.center.y < 0.0f) AddCollider(new CCollider(false, new CPlane(plane.distance, plane.normal, plane.center, plane.extents))); else AddCollider(new CCollider(false, new CPlane(plane.distance, plane.normal, plane.center, plane.extents),true, false)); } else AddCollider(new CCollider(false, new CPlane(plane.distance, plane.normal, plane.center, plane.extents))); } } } }