Skip to content

Commit

Permalink
Corrected WMO transform matrix generation. This fixes issue #67
Browse files Browse the repository at this point in the history
  • Loading branch information
namreeb committed Jul 25, 2024
1 parent 6d04d7f commit 2d279e5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions parser/Wmo/WmoPlacement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,28 @@ struct WmoPlacement
{
auto constexpr mid = 32.f * MeshSettings::AdtSize;

// rotation around x (north/south)
auto const rotX = math::Convert::ToRadians(Orientation.Z);

// rotation around y (east/west)
auto const rotY = math::Convert::ToRadians(Orientation.X);

// rotation around z (vertical)
auto const rotZ = math::Convert::ToRadians(Orientation.Y + 180.f);

// 0xFFFFFFFF is the unique id used for a global WMO (a map which has no
// ADTs but instead spawns a single WMO)
auto const translationMatrix =
const math::Matrix translationMatrix =
UniqueId == 0xFFFFFFFF ?
math::Matrix::CreateTranslationMatrix(
{BasePosition.Z, BasePosition.X, BasePosition.Y}) :
math::Matrix::CreateTranslationMatrix({mid - BasePosition.Z,
mid - BasePosition.X,
BasePosition.Y});

matrix = translationMatrix * math::Matrix::CreateRotationX(rotX) *
matrix = translationMatrix * math::Matrix::CreateRotationZ(rotZ) *
math::Matrix::CreateRotationY(rotY) *
math::Matrix::CreateRotationZ(rotZ);
math::Matrix::CreateRotationX(rotX);
}
};
#pragma pack(pop)
Expand Down

0 comments on commit 2d279e5

Please sign in to comment.