Commit 1b89cef4 authored by hybrid's avatar hybrid

Fix precision problems in getHorizontalAngle.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2880 dfc29bdd-3216-0410-991c-e03cc46cb475
parent db4c7a2c
......@@ -275,16 +275,17 @@ namespace core
{
vector3d<T> angle;
angle.Y = (T)(atan2(X, Z) * (T) RADTODEG64);
const f64 tmp = (atan2(X, Z) * RADTODEG64);
angle.Y = (T)tmp;
if (angle.Y < 0)
angle.Y += 360;
if (angle.Y >= 360)
angle.Y -= 360;
const T z1 = core::squareroot(X*X + Z*Z);
const f64 z1 = core::squareroot(X*X + Z*Z);
angle.X = (T)(atan2((f64)z1, (f64)Y) * RADTODEG64 - 90.0);
angle.X = (T)(atan2(z1, Y) * RADTODEG64 - 90.0);
if (angle.X < 0)
angle.X += 360;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment