Skip to content

BulletIntegration: fix Matrix3x3 conversion along with unit tests - #34

Closed
xqms wants to merge 1 commit into
mosra:masterfrom
xqms:bullet-fix-matrix3x3
Closed

xqms wants to merge 1 commit into
mosra:masterfrom
xqms:bullet-fix-matrix3x3

Conversation

@xqms

@xqms xqms commented Jan 8, 2019

Copy link
Copy Markdown
Contributor

Bullet matrices are row-major, Magnum matrices are column-major.
The Matrix3x3 unit test did not account for this and tested the wrong behavior.
The test for Matrix4x4 seems fine, haven't looked in detail, though.

This probably hasn't been noticed before because BulletIntegration::MotionState uses the Matrix3x3 conversion only in the Magnum -> Bullet direction, and this is typically only done once during btRigidBody initialization. The bullet example in magnum-examples uses identity rotation at initialization...

Bullet matrices are row-major, Magnum matrices are column-major.
The unit test did not account for this and tested the wrong behavior.
The test for Matrix4x4 seems fine, haven't looked in detail, though.
@mosra mosra self-assigned this Jan 9, 2019
@mosra mosra added this to the 2019.01 milestone Jan 9, 2019
@mosra

mosra commented Jan 9, 2019

Copy link
Copy Markdown
Owner

Hi, thanks a lot for reporting and fixing this!

Interesting (and frightening) that this hasn't been noticed yet, huh. Looking into Bullet sources at how the Matrix4 conversion is done, yeah this was definitely wrong. @Squareys were you aware of this?

Merged your commit in 67059e5 (without the debug prints) and then, in 13356bf, to be really sure, updated the 3x3 test to now also convert the matrix to a quaternion and check that it indeed produces a correct value.

@xqms

xqms commented Jan 9, 2019

Copy link
Copy Markdown
Contributor Author

Ah, sorry, the debug stuff should not have been in there, that slipped through. Thanks for checking and merging :-)

@xqms
xqms deleted the bullet-fix-matrix3x3 branch January 9, 2019 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

2 participants