I recently began using bullet (2.73) in our project and discovered something odd.
For testing, I exported a simple scene from 3DS max. The scene contains 4 planes.
Screenshot:
The planes are (left to right in the screenshot)
1. plane without rotation or scaling
Transformation matrix:
Code: Select all
[ 1.0000, 0.0000, -0.0000, -62.3693 ]
[ 0.0000, 1.0000, -0.0000, 9.0501 ]
[ -0.0000, -0.0000, 1.0000, -18.1408 ]
[ 0.0000, 0.0000, -0.0000, 1.0000 ]
Transformation matrix:
Code: Select all
[ 0.9418, -0.2212, 0.2532, -34.0320 ]
[ 0.3093, 0.8652, -0.3947, 8.9540 ]
[ -0.1318, 0.4501, 0.8832, -18.1408 ]
[ 0.0000, 0.0000, -0.0000, 1.0000 ]
Transformation matrix:
Code: Select all
[ 0.7260, 0.0000, -0.0000, -4.6945 ]
[ 0.0000, 0.7260, -0.0000, 8.3072 ]
[ -0.0000, -0.0000, 0.7260, -18.1408 ]
[ 0.0000, 0.0000, -0.0000, 1.0000 ]
Transformation matrix:
Code: Select all
[ 0.6920, -0.3558, 0.0661, 23.3640 ]
[ 0.3468, 0.6111, -0.3408, 7.9197 ]
[ 0.1035, 0.3313, 0.6995, -18.1408 ]
[ 0.0000, 0.0000, -0.0000, 1.0000 ]
I'm also using btMotionstate for setting/getting the transformation.
Plane 1 and 2 collide correctly with the capsule. The capsule goes right through plane 3 and 4. There's no collision at all.
The results are the same if I use a btBoxShape instead of btBvhTriangleShape.
It's looks to me that whenever a transformation matrix has a scale, collisions don't work.
I'm aware that the shape provides a setLocalScaling that enables scaling of shapes and I'd be happy to use it if I could.
However, all I get from 3DS max is the transformation, and I don't know how to extract and deduct the scaling from the transformation (safely).
I guess, one option would be to transform all vertices before using them for a btBvhTriangleMeshShape.
Problem is, we have a lot of instances and this would increase the memory consumption drastically.
Any help / hint or even a explanation of the problem is appreciated .
Thanks!