Player input properly separated from editor input and server

This commit is contained in:
2016-01-22 21:35:31 +01:00
parent 406b730ef3
commit 55ee2bb3bf
4 changed files with 54 additions and 25 deletions
+4 -3
View File
@@ -27,16 +27,17 @@ void PlayerMovementSystem::Update(double dt)
EntityWrapper cameraEntity = player.FirstChildByName("Camera");
if (cameraEntity.Valid()) {
glm::vec3& cameraOrientation = cameraEntity["Transform"]["Orientation"];
cameraOrientation.x = controller->Orientation().x;
cameraOrientation.x += controller->Rotation().x;
}
ComponentWrapper& cTransform = player["Transform"];
glm::vec3& ori = cTransform["Orientation"];
ori.y = controller->Orientation().y;
ori.y += controller->Rotation().y;
glm::vec3& pos = cTransform["Position"];
pos += controller->Movement() * glm::inverse(glm::quat(ori)) * (float)player["Player"]["MovementSpeed"] * (float)dt;
controller->Reset();
}
}