From 0e77b468f4096c4fe7042db1e4ef99aa6cae3cec Mon Sep 17 00:00:00 2001 From: praydog Date: Thu, 10 Oct 2024 08:03:09 -0700 Subject: [PATCH] Lua: Return FRotator as Vector3/f/d --- lua-api/lib/src/ScriptUtility.cpp | 2 +- lua-api/lib/src/datatypes/Vector.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lua-api/lib/src/ScriptUtility.cpp b/lua-api/lib/src/ScriptUtility.cpp index cb01ace3..72aca99d 100644 --- a/lua-api/lib/src/ScriptUtility.cpp +++ b/lua-api/lib/src/ScriptUtility.cpp @@ -151,7 +151,7 @@ sol::object prop_to_object(sol::this_state s, void* self, uevr::API::FProperty* return sol::make_object(s, sol::lua_nil); } - if (struct_desc == get_vector_struct()) { + if (struct_desc == get_vector_struct() || struct_desc == get_rotator_struct()) { if (is_ue5()) { if (is_self_temporary) { return sol::make_object(s, *(lua::datatypes::Vector3d*)struct_data); diff --git a/lua-api/lib/src/datatypes/Vector.cpp b/lua-api/lib/src/datatypes/Vector.cpp index f5275796..c68de39a 100644 --- a/lua-api/lib/src/datatypes/Vector.cpp +++ b/lua-api/lib/src/datatypes/Vector.cpp @@ -11,6 +11,9 @@ namespace lua::datatypes { "X", &name::x, \ "Y", &name::y, \ "Z", &name::z, \ + "Pitch", &name::x, \ + "Yaw", &name::y, \ + "Roll", &name::z, \ "dot", [](name& v1, name& v2) { return glm::dot(v1, v2); }, \ "cross", [](name& v1, name& v2) { return glm::cross(v1, v2); }, \ "length", [](name& v) { return glm::length(v); }, \ @@ -45,6 +48,9 @@ namespace lua::datatypes { "Y", &name::y, \ "Z", &name::z, \ "W", &name::w, \ + "Pitch", &name::x, \ + "Yaw", &name::y, \ + "Roll", &name::z, \ "dot", [](name& v1, name& v2) { return glm::dot(v1, v2); }, \ "length", [](name& v) { return glm::length(v); }, \ "normalize", [](name& v) { v = glm::normalize(v); }, \