Re: [Algorithms] OBBs & Max
Brought to you by:
vexxed72
From: Pierre T. <p.t...@wa...> - 2000-08-10 21:50:20
|
Apparently this issue has been bugging you for a long time now.... Well. I've been using RAPID and MAX together as well, and it just works. I've never had such troubles - that's also why I was surprised by Kent Quirk's recent post about the wrong matrix in RAPID. I export from MAX 3.1 using this, ... http://www.codercorner.com/Flexporter.htm ...then use my enhanced RAPID version... http://www.codercorner.com/RAPID_Hack.htm ...packed in my collision detection lib: http://www.codercorner.com/ZCollide.htm On a side note, a related link: http://www.codercorner.com/Gottschalk.htm It just works. A friend of mine nonetheless, started using RAPID some months ago now, and reported some problems : collisions weren't detected. We looked into it, and it appeared he was using an old RAPID version (1.04 I think). I gave him the last one. He recompiled. And... it just worked like the proverbial charm. It's been working for months now. So, to make things clear once and for all, I really think the problem lies somewhere in your code, not in MAX nor in RAPID. Or maybe you're using an old RAPID version as well ? I suspect you just feed RAPID with wrong rotation matrices, even if that's something you must have checked to death now... Here's the way I use: Say you matrix is defined as an array of 16 floats: float m[4][4]; That matrix is D3D-compliant. That is, I can send that directly to D3D as a world matrix. Now, here's the rotation matrix to send to RAPID: float R1[3][3]; Say M1 is a pointer to a D3D-compliant matrix. The transform is: R1[0][0] = M1->m[0][0]; R1[0][1] = M1->m[1][0]; R1[0][2] = M1->m[2][0]; R1[1][0] = M1->m[0][1]; R1[1][1] = M1->m[1][1]; R1[1][2] = M1->m[2][1]; R1[2][0] = M1->m[0][2]; R1[2][1] = M1->m[1][2]; R1[2][2] = M1->m[2][2]; In other words, you must transpose the rotation part of the D3D matrix before sending it to RAPID. Once again, everything else (MAX, RAPID) ... just works. Pierre ----- Original Message ----- From: <Nik...@ao...> To: <gda...@li...> Sent: Thursday, July 27, 2000 8:00 AM Subject: [Algorithms] OBBs & Max > Recently, I've been creating an OBB collision detection system for my engine, > and I loosely used the RAPID library as a guide when creating my own > functions. The data that I use originates from 3D Studio Max 3.1. I have > been having much difficulty with the accuracy of the system, so I attempted > to use the RAPID library itself to see if that functioned correctly. > However, the RAPID library is giving the same results as my own, it > inaccurately reports collision with even the most simple models (such as two > boxes, in which only one has rotation). Is there a problem with the library, > or with Max? The data I am receiving from Max displays correctly when > rendered with D3D (in the exporter I change the coordinate system from Max's > to D3D's). Could this change in coordinate systems be the problem? In this > transformation, I change the order of the vertices on each face, and I flip > rows 2 and 3 in the transformation matrix, along with the y & z coordinates > in the matrix and the vertices. Also, when a box is created in Max, it is > defined with the center being at the bottom of the box, and the rotation and > translation matrix compensate for this (depending on where the pivot point is > located), to make the scene look correct. (As I mentioned earlier, the when > I render this data in D3D, it looks exactly like what it did in Max, in > addition, the collision detection is accurate if neither model is rotated. > Any help would be appreciated. > > Thanks, > Nik...@ao... > > _______________________________________________ > GDAlgorithms-list mailing list > GDA...@li... > http://lists.sourceforge.net/mailman/listinfo/gdalgorithms-list |