fix spaceship rotation fix sync boxes
This commit is contained in:
1 parent
be2aa76f8b
commit
7418bbbe27
5 files changed
+68
-23
No files matched your search
+12
-5
@@ -331,7 +331,7 @@ namespace ZL
|
||||
auto rotMatrix2 = quat2.toRotationMatrix();
|
||||
cargoBase.RotateByMatrix(rotMatrix2);
|
||||
//cargoBase.RotateByMatrix(Eigen::Quaternionf(Eigen::AngleAxisf(M_PI, Eigen::Vector3f::UnitY())).toRotationMatrix());
|
||||
cargoBase.Move(Vector3f{ 1.2, 0, -5 });
|
||||
cargoBase.Move(Vector3f{ 0, 0, -5 });
|
||||
cargo.AssignFrom(cargoBase);
|
||||
cargo.RefreshVBO();
|
||||
|
||||
@@ -639,13 +639,15 @@ namespace ZL
|
||||
// Е�ли �ервер при�лал коробки, примен�ем их однократно вме�то локальной генерации
|
||||
if (!serverBoxesApplied && networkClient) {
|
||||
auto sboxes = networkClient->getServerBoxes();
|
||||
auto destroyedFlags = networkClient->getServerBoxDestroyedFlags();
|
||||
if (!sboxes.empty()) {
|
||||
boxCoordsArr.clear();
|
||||
for (auto& b : sboxes) {
|
||||
boxCoordsArr.resize(sboxes.size());
|
||||
for (size_t i = 0; i < sboxes.size(); ++i) {
|
||||
BoxCoords bc;
|
||||
bc.pos = b.first;
|
||||
bc.m = b.second;
|
||||
boxCoordsArr.push_back(bc);
|
||||
bc.pos = sboxes[i].first;
|
||||
bc.m = sboxes[i].second;
|
||||
boxCoordsArr[i] = bc;
|
||||
}
|
||||
boxRenderArr.resize(boxCoordsArr.size());
|
||||
for (int i = 0; i < (int)boxCoordsArr.size(); ++i) {
|
||||
@@ -653,6 +655,11 @@ namespace ZL
|
||||
boxRenderArr[i].RefreshVBO();
|
||||
}
|
||||
boxAlive.assign(boxCoordsArr.size(), true);
|
||||
if (destroyedFlags.size() == boxAlive.size()) {
|
||||
for (size_t i = 0; i < boxAlive.size(); ++i) {
|
||||
if (destroyedFlags[i]) boxAlive[i] = false;
|
||||
}
|
||||
}
|
||||
serverBoxesApplied = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user