"Rotation.FromYaw is counter-clockwise"
- A vehicle consistently steers the opposite direction from input — keyboard left turns right, autopilot spirals into hazards.
- AI pathfinding cross-product steering drives the agent away from the target instead of toward it.
- The code looks correct — the sign bug is invisible in a static test, only obvious when something moves.
Rotation.FromYaw(+angle) is a left (counter-clockwise) turn when viewed from above, following the Source engine's coordinate convention (+X forward, +Y left). If your steering math assumes positive = right turn (the common intuition from vehicle sims), every +steer input turns the wrong way.
This is especially insidious in autopilot / AI steering where a cross-product computes the turn direction — a sign swap silently inverts the entire navigation and the vehicle consistently drives into walls or off the map.
Negate the yaw for right-positive steering:
// Right-positive steer input: negate for FromYaw
Rotation steerRot = WorldRotation * Rotation.FromYaw(-steer);For AI cross-product steering, verify the sign once:
// Cross product gives turn direction
float cross = Vector3.Cross(forward, toTarget).z;
// cross > 0 means target is to the LEFT in Source convention
// FromYaw(+) turns LEFT, so:
float steer = cross * steerGain;
Rotation turn = Rotation.FromYaw(steer);
// This naturally turns toward the targetDiagnostic: If the vehicle or agent consistently heads the opposite way from where it's told, treat it as a FromYaw sign error first. One sign flip at the steering application point fixes it everywhere — don't chase the bug through the pathfinding logic.
Source 2 / s&box uses a coordinate system where +X is forward and +Y is left. FromYaw(+angle) rotates from +X toward +Y — which is counter-clockwise (leftward) when viewed from above (+Z). This is mathematically consistent within the engine, but it catches anyone who assumes the more common "positive = clockwise / rightward" convention from vehicle sims or Unity.