diff --git a/Engine/source/math/mRotation.cpp b/Engine/source/math/mRotation.cpp index d915348d6..69dfca35d 100644 --- a/Engine/source/math/mRotation.cpp +++ b/Engine/source/math/mRotation.cpp @@ -20,6 +20,8 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- #include "math/mRotation.h" +#include "console/console.h" +#include "console/engineAPI.h" #ifdef TORQUE_TESTS_ENABLED #include "testing/unitTesting.h" @@ -296,4 +298,51 @@ TEST(Maths, RotationF_Calculations) { //TODO: implement unit test }; -#endif \ No newline at end of file +#endif + +DefineConsoleStaticMethod(Rotation, Add, RotationF, (RotationF a, RotationF b), , + "Adds two rotations together.\n" + "@param a Rotation one." + "@param b Rotation two." + "@returns v sum of both rotations." + "@ingroup Math") +{ + return a + b; +} + +DefineConsoleStaticMethod(Rotation, Subtract, RotationF, (RotationF a, RotationF b), , + "Subtracts two rotations.\n" + "@param a Rotation one." + "@param b Rotation two." + "@returns v difference of both rotations." + "@ingroup Math") +{ + return a - b; +} + +DefineConsoleStaticMethod(Rotation, Interpolate, RotationF, (RotationF a, RotationF b, F32 factor), , + "Interpolates between two rotations.\n" + "@param a Rotation one." + "@param b Rotation two." + "@param factor The amount to interpolate between the two." + "@returns v, interpolated result." + "@ingroup Math") +{ + RotationF result; + result.interpolate(a, b, factor); + return result; +} + +DefineConsoleStaticMethod(Rotation, LookAt, RotationF, (Point3F origin, Point3F target, Point3F up), + (Point3F(0, 0, 0), Point3F(0, 0, 0), Point3F(0, 0, 1)), + "Provides a rotation orientation to look at a target from a given position.\n" + "@param origin Position of the object doing the looking." + "@param target Position to be looked at." + "@param up The up angle to orient the rotation." + "@returns v orientation result." + "@ingroup Math") +{ + RotationF result; + result.lookAt(origin, target, up); + return result; +} \ No newline at end of file diff --git a/Engine/source/math/mathTypes.cpp b/Engine/source/math/mathTypes.cpp index dd018b2a4..9e5605207 100644 --- a/Engine/source/math/mathTypes.cpp +++ b/Engine/source/math/mathTypes.cpp @@ -583,7 +583,7 @@ ConsoleSetType( TypeEaseF ) // TypeRotationF //----------------------------------------------------------------------------- ConsoleType(RotationF, TypeRotationF, RotationF, "") -//ImplementConsoleTypeCasters( TypeRotationF, RotationF ) +ImplementConsoleTypeCasters( TypeRotationF, RotationF ) ConsoleGetType(TypeRotationF) {