Skip to content

Commit

Permalink
Lua: Return FRotator as Vector3/f/d
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Oct 10, 2024
1 parent a178738 commit 0e77b46
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lua-api/lib/src/ScriptUtility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions lua-api/lib/src/datatypes/Vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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); }, \
Expand Down Expand Up @@ -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); }, \
Expand Down

0 comments on commit 0e77b46

Please sign in to comment.