I have written a wrapper for coldet.
A collision dectection lib.
Everything works fine except that the matrix function I use
must be pretty buggy.
Is there a matrix guru out there?
Untill I find the problem I post the problematic function here.
When this is solved I will release the lib.
A collision dectection lib.
Everything works fine except that the matrix function I use
must be pretty buggy.
Is there a matrix guru out there?
Untill I find the problem I post the problematic function here.
When this is solved I will release the lib.
DLL void _stdcall coldet_set_matrix(void *a,float px,float py,float pz,float pitch,float yaw,float roll) { CollisionModel3D*model= static_cast<CollisionModel3D*>(a); //the matrix float mat[16]; //convert to radians //where pir=pi/180 pitch=pitch*pir; yaw=yaw*pir; roll=roll*pir; float A = cos(pitch); float B = sin(pitch); float C = cos(yaw); float D = sin(yaw); float E = cos(roll); float F = sin(roll); float AD = A * D; float BD = B * D; mat[0] = C * E; mat[1] = -C * F; mat[2] = D; mat[3] = 0; mat[4] = BD * E + A * F; mat[5] = -BD * F + A * E; mat[6] = -B * C; mat[7] = 0; mat[8] = -AD * E + B * F; mat[9] = AD * F + B * E; mat[10] = A * C; mat[11] = 0; mat[12] = px; mat[13] = py; mat[14] = pz; mat[15] = 1; model->setTransform (mat); }