-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
get_translation() and set_translation() of Matrix44 not working correctly #72
Comments
Is this a generic problem or specific to only that use case. |
Upon testing, a Matrix33 (rotation on a NiTriShape) also seems to be transposed compared to how it is displayed in NifSkope. I wouldn't be unreasonable to assume that other matrices are, too (not that there are many more for which this matters). However, I wouldn't necessarily call it being transposed a problem, it's just a discrepancy between NifSkope and pyffi. They both work out the same, mathematically, in the NifSkope case it's (row vector)*matrix and if it's transposed (pyffi) it (should be) matrix*(column vector). However, this difference isn't accounted for in the get_translation and set_translation functions, and they act as though the translation is in the bottom row (which it isn't). Being consistent with that would, however, also lead to changes with the vector*matrix calculations (which need to be matrix*vector and are currently only vector*matrix). I should note that the get_mass_center_inertia function of the bhkTransformShape class does seem to be aware that the translation lies in the fourth column, as it takes m_14, m_24 and m_34 rather than using the get_translation() function of the transform. This is, of course, all presuming I haven't missed some extra step that somehow happens when using the blender nif plugin after/before file data.read(stream) or data.write(stream), respectively, or that I haven't missed something in the way the matrices are printed. |
@niftools/pyffi-reviewers
Issue Overview
Because the Matrix44 class is imported/exported transposed to how it is displayed in NifSkope, the get_translation() and set_translation() functions of that class do not work as expected.
Version Information
Pyffi Version Info
2.2.4.dev3, can confirm it is also happening with 2.2.4.dev4
Platform information
Windows 10 64-bit, using pyffi through the Blender Nif plugin.
Context
The transform of a bhkConvexTransformShape is transposed to how it is displayed in NifSkope. This is even right after the pyffi import (i.e. at the end of the load_nif function) or right before pyffi export (i.e. just before the data.write(stream)). This means that the get_translation() and set_translation() functions, which set and get from the bottom row (correct with how it is displayed in NifSkope), do not operate on the translation, but on the useless fourth column once back in NifSkope.
Steps to Reproduce
Expected Result
The expected result is that get_translation() and set_translation() do the intended modification.
Actual Result
There is no modification on the exported translation, instead the fourth column is affected.
Possible Fix
Either change get_translation() and set_translation() to reflect the fact that the Matrix44 is transposed upon import/export, or do not transpose the Matrix44.
Screenshot
Logs and Files
File I tested with:
https://cdn.discordapp.com/attachments/702566403605266435/706515307014914138/irondagger.nif
Console Output
Relevant output found in screenshots above.
Similar Known Issues
None that I could find.
Additional Information
The text was updated successfully, but these errors were encountered: