]> git.localhorst.tv Git - blank.git/blobdiff - src/ai/ai.cpp
new turn style
[blank.git] / src / ai / ai.cpp
index fc6abfc4b9e59fa0133ad1bb66c4776e4595b049..c47b4d3893de5a0483b86033ef16ad3f817f9644 100644 (file)
@@ -100,9 +100,13 @@ void AIController::Update(Entity &e, float dt) {
        if (e.Moving()) {
                // orient head towards heading
                glm::vec3 heading(e.Heading());
-               float tgt_pitch = std::atan(heading.y / length(glm::vec2(heading.x, heading.z)));
-               float tgt_yaw = std::atan2(-heading.x, -heading.z);
+               // only half pitch, so we don't crane our neck
+               float tgt_pitch = std::atan(heading.y / length(glm::vec2(heading.x, heading.z))) * 0.5f;
+               // always look straight ahead
+               // maybe look at the pursuit target if there is one
+               float tgt_yaw = 0.0f;
                e.SetHead(tgt_pitch, tgt_yaw);
+               e.OrientBody(dt);
        }
 }