diff options
Diffstat (limited to 'src/engine/StaticMeshActor.h')
| -rw-r--r-- | src/engine/StaticMeshActor.h | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/engine/StaticMeshActor.h b/src/engine/StaticMeshActor.h index 4007aa2c1..b0dad88be 100644 --- a/src/engine/StaticMeshActor.h +++ b/src/engine/StaticMeshActor.h @@ -7,7 +7,7 @@ // todo: Make this class AStaticMeshActor : public AActor class StaticMeshActor { -public: + public: std::string Name; FVector Pos; IRotator Rot; @@ -22,16 +22,16 @@ public: // Serialize each field of the class j["Name"] = Name; - j["Position"] = {Pos.x, Pos.y, Pos.z}; // Assuming FVector has x, y, z fields - j["Rotation"] = {Rot.pitch, Rot.yaw, Rot.roll}; // Assuming IRotator has pitch, yaw, roll fields - j["Scale"] = {Scale.x, Scale.y, Scale.z}; // Assuming FVector has x, y, z fields + j["Position"] = { Pos.x, Pos.y, Pos.z }; // Assuming FVector has x, y, z fields + j["Rotation"] = { Rot.pitch, Rot.yaw, Rot.roll }; // Assuming IRotator has pitch, yaw, roll fields + j["Scale"] = { Scale.x, Scale.y, Scale.z }; // Assuming FVector has x, y, z fields j["Model"] = Model; // If Collision is not null, serialize it if (Collision != nullptr) { - j["Collision"] = *Collision; // Serialize the value that Collision points to + j["Collision"] = *Collision; // Serialize the value that Collision points to } else { - j["Collision"] = nullptr; // Handle the case where Collision is nullptr + j["Collision"] = nullptr; // Handle the case where Collision is nullptr } return j; @@ -39,20 +39,22 @@ public: void from_json(const nlohmann::json& j) { Name = j.at("Name").get<std::string>(); - Pos = FVector(j.at("Position")[0].get<float>(), j.at("Position")[1].get<float>(), j.at("Position")[2].get<float>()); - Rot.Set(j.at("Rotation")[0].get<uint16_t>(), j.at("Rotation")[1].get<uint16_t>(), j.at("Rotation")[2].get<uint16_t>()); + Pos = FVector(j.at("Position")[0].get<float>(), j.at("Position")[1].get<float>(), + j.at("Position")[2].get<float>()); + Rot.Set(j.at("Rotation")[0].get<uint16_t>(), j.at("Rotation")[1].get<uint16_t>(), + j.at("Rotation")[2].get<uint16_t>()); Scale = FVector(j.at("Scale")[0].get<float>(), j.at("Scale")[1].get<float>(), j.at("Scale")[2].get<float>()); // Deserialize the Model string Model = j.at("Model").get<std::string>(); // Check if Collision is present in the JSON and deserialize it - //if (j.contains("Collision") && !j["Collision"].is_null()) { - // If Collision is a valid value, allocate memory for it and assign the value + // if (j.contains("Collision") && !j["Collision"].is_null()) { + // If Collision is a valid value, allocate memory for it and assign the value // Collision = new int32_t(j.at("Collision").get<int32_t>()); //} else { - // If Collision is not present or is null, set it to nullptr - Collision = nullptr; + // If Collision is not present or is null, set it to nullptr + Collision = nullptr; //} } |
