This commit is contained in:
Vlad committed 2026-02-02 14:45:36 +06:00
1 parent 204b79bf06
commit 88f68b20ea
4 files changed
+63 -16

No files matched your search

+3 -1
View File
@@ -11,7 +11,9 @@ namespace ZL {
int shooterId = -1;
uint64_t clientTime = 0;
Eigen::Vector3f position = Eigen::Vector3f::Zero();
Eigen::Vector3f direction = Eigen::Vector3f::Zero();
//Eigen::Vector3f direction = Eigen::Vector3f::Zero();
Eigen::Matrix3f rotation = Eigen::Matrix3f::Identity();
float velocity = 0;
};
class INetworkClient {
+7 -3
View File
@@ -128,7 +128,7 @@ namespace ZL {
if (msg.rfind("PROJECTILE:", 0) == 0) {
auto parts = split(msg, ':');
if (parts.size() >= 9) {
if (parts.size() >= 10) {
try {
ProjectileInfo pi;
pi.shooterId = std::stoi(parts[1]);
@@ -138,11 +138,15 @@ namespace ZL {
std::stof(parts[4]),
std::stof(parts[5])
);
pi.direction = Eigen::Vector3f(
Eigen::Quaternionf q(
std::stof(parts[6]),
std::stof(parts[7]),
std::stof(parts[8])
std::stof(parts[8]),
std::stof(parts[9])
);
pi.rotation = q.toRotationMatrix();
pi.velocity = std::stof(parts[10]);
std::lock_guard<std::mutex> pl(projMutex_);
pendingProjectiles_.push_back(pi);
}