diff --git a/Engine/source/math/mRotation.cpp b/Engine/source/math/mRotation.cpp index 43b696d4a..18114c58d 100644 --- a/Engine/source/math/mRotation.cpp +++ b/Engine/source/math/mRotation.cpp @@ -325,14 +325,21 @@ TEST(Maths, RotationF_Calculations) }; #endif -DefineEngineFunction(AddRotation, RotationF, (RotationF a, RotationF b), , +DefineEngineFunction(AddRotation, RotationF, (RotationF a, RotationF b, const char* returnType), ("Euler"), "Adds two rotations together.\n" "@param a Rotation one." "@param b Rotation two." "@returns v sum of both rotations." "@ingroup Math") { - return a + b; + RotationF ret; + RotationF sum = a + b; + if (String(returnType) == String("Euler")) + ret.set(sum.asEulerF()); + else + ret.set(sum.asAxisAngle()); + + return ret; } DefineEngineFunction(SubtractRotation, RotationF, (RotationF a, RotationF b), , diff --git a/Engine/source/math/mathTypes.cpp b/Engine/source/math/mathTypes.cpp index 14c7335e8..70ac9adf7 100644 --- a/Engine/source/math/mathTypes.cpp +++ b/Engine/source/math/mathTypes.cpp @@ -620,8 +620,16 @@ ConsoleGetType(TypeRotationF) static const U32 bufSize = 256; char* returnBuffer = Con::getReturnBuffer(bufSize); - EulerF out = pt->asEulerF(RotationF::Degrees); - dSprintf(returnBuffer, bufSize, "%g %g %g", out.x, out.y, out.z); + if (pt->mRotationType == RotationF::Euler) + { + EulerF out = pt->asEulerF(RotationF::Degrees); + dSprintf(returnBuffer, bufSize, "%g %g %g", out.x, out.y, out.z); + } + else if (pt->mRotationType == RotationF::AxisAngle) + { + AngAxisF out = pt->asAxisAngle(RotationF::Degrees); + dSprintf(returnBuffer, bufSize, "%g %g %g %g", out.axis.x, out.axis.y, out.axis.z, out.angle); + } return returnBuffer; }