Archived

This topic is now archived and is closed to further replies.

Lib3DS and matrices

This topic is 5651 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello peeps, OK, everyone who has ever used Lib3DS will know that meshes are specified in world coords (annoyingly). I'm trying to get my mesh to move to the world origin and rotate it so it's facing the world axis correctly (so basiclly it's aligned with the world axis). The mesh matrix is given in Lib3DS, so I guess I just invert the mesh matrix and apply that to all the vertices to get the mesh to be at the origin aligned with the world axis. For some reason it doesn't work . Anyone know why? Here's some code:
    
Lib3dsMatrix M;
lib3ds_matrix_copy(M, mesh->matrix);
if ( lib3ds_matrix_inv(M) != LIB3DS_TRUE)
{
    MessageBox(ft_App()->hWnd, "Cannot invert mesh matrix", "Warning", MB_OK);
}

D3DXMATRIX tmpM = MATRIX(*M);
		
MyObject->MultMatrix(tmpM);
  
Thanks for any help. [edited by - jimfing on June 26, 2002 12:19:37 PM]

Share this post


Link to post
Share on other sites
Oh yeah, forgot to say in what way it''s not working:

The object appears in the wrong place (not the origin) and is rotated incorrectly (not aligned to world axis).

Share this post


Link to post
Share on other sites