Fix the calculation of the angle in the x-y plane.

This commit is contained in:
Giulio Camuffo 2011-03-31 21:01:35 +02:00
parent 5f0d6adcdd
commit 19fcfd63b4

View File

@ -95,8 +95,9 @@ public:
// Get the angle a vector is around the unit circle
// (ignores z-component)
float unitCircleAngle() const {
float a = x() / magnitude();
float b = y() / magnitude();
const float mag = sqrt(x() * x() + y() * y());
float a = x() / mag;
float b = y() / mag;
float yaw;
// find the angle on the upper half of the unit circle