Frodo45127 / rpfm

Rusted PackFile Manager (RPFM) is a... reimplementation in Rust and Qt5 of PackFile Manager (PFM), one of the best modding tools for Total War Games.
MIT License
357 stars 57 forks source link

implement rotational matrix operations #256

Closed Klissans closed 1 year ago

Klissans commented 1 year ago

Implemented Rotational Matrix operations

An example file with scales != 1.0 and 3 angles would be beneficial for testing. As I'm not sure I'm normalizing correctly.

Pivot is not defined in the matrix, so used defaults (0, 0, 0)

Due to the nature of Euler angles, we have to compare transformation matrices, as the extracted angles might not match the original ones.

Frodo45127 commented 1 year ago

I've added another bunch testing files (test_prefab.xxx) with all values (position, rotation, scale and pivot) changed to unique values to the test_files/fastbin folder on the develop branch. They also contain some objects which have a 4x4 matrix, though the last column seems to always be 0,0,0,1. Just added them just in case they affect the operations.

Klissans commented 1 year ago

Matrices seem to match

I tried to restore pivot point and original point from the rotation matrix and translate the vector(or is it a position) but had no success.

As I understand, if objects are visualized correctly using the positions from the matrix and pivot=(0,0,0), we are good, if not - will try again..

Frodo45127 commented 1 year ago

Good news: tested it in terry, and a building with the resulting values ends up in the exact same place as the original one from the test prefab. Meaning it works. I'm going to clean it up and merge the 3x4 and 4x4 behavior, do some more testing with a full map, and if nothing breaks, merge it.