Fixed position & direction when copying object from F12 menu

master
krzys-h 2015-08-03 22:26:22 +02:00
parent 522c54afc3
commit 13ef6e5498
2 changed files with 6 additions and 3 deletions

View File

@ -83,7 +83,8 @@ CLevelParserParam::CLevelParserParam(Math::Point value)
CLevelParserParam::CLevelParserParam(Math::Vector value) CLevelParserParam::CLevelParserParam(Math::Vector value)
{ {
m_array.push_back(MakeUnique<CLevelParserParam>(value.x)); m_array.push_back(MakeUnique<CLevelParserParam>(value.x));
m_array.push_back(MakeUnique<CLevelParserParam>(value.y)); if(value.y != 0.0f)
m_array.push_back(MakeUnique<CLevelParserParam>(value.y));
m_array.push_back(MakeUnique<CLevelParserParam>(value.z)); m_array.push_back(MakeUnique<CLevelParserParam>(value.z));
LoadArray(); LoadArray();

View File

@ -907,8 +907,10 @@ bool CRobotMain::ProcessEvent(Event &event)
{ {
CLevelParserLine line("CreateObject"); CLevelParserLine line("CreateObject");
line.AddParam("type", MakeUnique<CLevelParserParam>(obj->GetType())); line.AddParam("type", MakeUnique<CLevelParserParam>(obj->GetType()));
line.AddParam("pos", MakeUnique<CLevelParserParam>(obj->GetPosition())); Math::Vector pos = obj->GetPosition()/g_unit;
line.AddParam("dir", MakeUnique<CLevelParserParam>(obj->GetRotationZ()/(Math::PI/180.0f))); pos.y = 0.0f;
line.AddParam("pos", MakeUnique<CLevelParserParam>(pos));
line.AddParam("dir", MakeUnique<CLevelParserParam>(obj->GetRotationY()));
std::stringstream ss; std::stringstream ss;
ss << line; ss << line;