diff --git a/src/core/modules/mathlib/mathlib.h b/src/core/modules/mathlib/mathlib.h old mode 100644 new mode 100755 index c83b7a536..c2cac3d89 --- a/src/core/modules/mathlib/mathlib.h +++ b/src/core/modules/mathlib/mathlib.h @@ -94,6 +94,12 @@ class VectorExt vecCopy -= val; return vecCopy; } + + static inline Vector __neg__(Vector vecCopy) + { + vecCopy.Negate(); + return vecCopy; + } }; diff --git a/src/core/modules/mathlib/mathlib_wrap.cpp b/src/core/modules/mathlib/mathlib_wrap.cpp old mode 100644 new mode 100755 index 45a5b9f93..5628ccdeb --- a/src/core/modules/mathlib/mathlib_wrap.cpp +++ b/src/core/modules/mathlib/mathlib_wrap.cpp @@ -158,6 +158,8 @@ void export_vector(scope _mathlib) .def("__radd__", &VectorExt::__add__) .def(float() * self) + .def("__neg__", &VectorExt::__neg__) + .def("negate", &Vector::Negate, "Negates the vector." @@ -211,6 +213,23 @@ void export_vector(scope _mathlib) "Returns True if the vector is within the given box coordinates." ) + .def("get_vector_vectors", + &VectorVectors, + (arg("right"), arg("up")) + ) + + .def("get_vector_angles", + GET_FUNCTION(void, VectorAngles, const Vector &, QAngle &), + arg("angles"), + "Forward direction vector -> Euler angles." + ) + + .def("get_vector_angles", + GET_FUNCTION(void, VectorAngles, const Vector &, const Vector &, QAngle &), + (arg("pseudoup"), arg("angles")), + "Forward direction vector with a reference up vector -> Euler angles." + ) + .def("get_distance", &Vector::DistTo, args("other"),