Horde3D http://horde3d.org/forums/ |
|
ODE rotations problem http://horde3d.org/forums/viewtopic.php?f=2&t=380 |
Page 1 of 1 |
Author: | lachlanmcdowall [ 16.06.2008, 15:54 ] |
Post subject: | ODE rotations problem |
I am attempting to use ODE physics and Horde3D but am having considerable problems with orientating the object within the world. Code: // get the possition, offset of bounding box and orientation SGZVECTOR pos = ODEWorld->getPos(odeIndex); SGZVECTOR offset = ODEWorld->getOffset(odeIndex); const float* q = ODEWorld->getQuaternion(odeIndex); // create matrix's Matrix4f mat = Matrix4f(); Matrix4f qMat(q); // perform matrix concatination mat.translate(-offset.x, -offset.y, -offset.z); mat = mat * qMat; mat.translate(pos.x, pos.y, pos.z); // place object bool temp = Horde3D::setNodeTransformMatrix( (NodeHandle)lua_tonumber(Lua, 1), mat.x); there are very weird effects of the objects appearing to scale in iratic fashions though without the quaternian matrix being taken into acount the objects are placed correctly |
Author: | marciano [ 16.06.2008, 20:08 ] |
Post subject: | Re: ODE rotations problem |
There seems to be a problem in your code. ODEWorld->getQuaternion probably returns a 4-tuple of floats. Matrix4f has a constructor that takes a float pointer but it expects a linearized matrix with 16 floats. You should probably init an instance of the Quaternion class with the 4 values you get from ODE and feed that to a Matrix4f constructor. |
Author: | lachlanmcdowall [ 17.06.2008, 10:35 ] |
Post subject: | Re: ODE rotations problem |
That was indead my problem, long day with stuff not working makes you blind to the obvious |
Author: | lachlanmcdowall [ 19.06.2008, 16:30 ] |
Post subject: | Re: ODE rotations problem |
Also anyone wanting to take note the quaternions thrown out of ode are in order w,x,y,z and the quaternions in horde are x,y,z,w this along with having to perform the matrix concatination in the order mat = q*mat. These got me as well so thought i would share for others in future |
Page 1 of 1 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |