Welcome! Log In Create A New Profile


Bullet physics 4x4 matrix problem

Posted by copete23 
Bullet physics 4x4 matrix problem
July 21, 2011 01:15AM
Hi, i'm trying to integrate Bullet physics in my project, I got it working, but I'm not sure how to translate the transformation of physical objects, to the 3D models.

Bullet uses this function to store the transformations of objects in a Matrix, then pass it to the 3d model:

btRigidBody-> getWorldTransform ().getOpenGLMatrix(Matrix);

But there is a problem, OpenGL uses 4x4 matrix (float [16]) and Gx uses 3x4 matrix, and i don`t know how to convert that array from 4x4 to 3x4.

Anyone know how I could solve this problem?

Thanks in advance :)
Re: Bullet physics 4x4 matrix problem
July 21, 2011 07:35PM
I've never really thought about what a matrix is all about, you post made me think about it.
You will know this but I had no idea, anyway I found out the that GX Mtx[3][4] is able to translate and rotate, having a vector for each x,y,z axis & a vector for translation if I understand things.

So any idea what the extra vector in the GL 4x4 does?
Maybe it's possible to just drop it the extra part? If it's used say for perspective, I guessing instead you might need to 'guMtxConcat' the cut down matrix with with the camera matrix instead.

How come you’re using openGL for the Wii platform
Re: Bullet physics 4x4 matrix problem
July 21, 2011 08:41PM
Thanks, I've solved, it was not so complicated after all xD actually the 4x4 matrix is only a 3x4 matrix with some extra vectors that bullet physics do not use , so the only thing to do is find out the position vector x, y, z, the scale vector, etc... in each type of matrix,

This is what I've done:

f32 worldMat[16]; //the 4x4 matrix
Mtx m; // 3x4 matrix


//Then copy all the values ??to the  3x4 array in this order


And that's all, is not very nice, but it works perfectly :D

PS: i`m not using opengl, was only, that function, uses typical matrices of OpenGL :)

Edited 1 time(s). Last edit at 07/21/2011 09:04PM by copete23.
Sorry, only registered users may post in this forum.

Click here to login