Spielerando

Keep a turret aimed at the enemy while the vehicle under it turns

A tank or ship with a turret on top looks fake if the gun swings round with the hull and then catches up late. Here is how to let the base and the gun turn at their own speeds, and why the gun must correct for the base before it does anything else.

Why this works

The aim belongs to the world, but the picture is drawn relative to the base. When the base turns, the gun must first give back exactly that turn, so it keeps pointing where it did. Only then does its own turning speed count.

When not to use it

Not needed when the gun is fixed to the vehicle, like a car's front headlight or a plane's forward guns. There the whole body is the aim, so turn the vehicle and skip the second layer.

In the full entry

  • What to build, step by step
  • Starting values and the reason for each
  • 4 common mistakes and the fix
  • 32 lines of example code with 4 checks that pass
  • How your AI shows you that it works

Say this to your AI

Use the Spielerando entry "Keep a turret aimed at the enemy while the vehicle under it turns" (read_entry turret-keeps-its-aim-while-the-hull-turns) in my game. Build it step by step, and show me how you checked that it works.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP