[ODE] Using ODE with DirectX

Ivan Bolcina ivan.bolcina at volja.net
Wed Mar 19 01:47:02 2003


This is a multi-part message in MIME format.

------=_NextPart_000_0014_01C2ED92.889BB870
Content-Type: text/plain;
	charset="utf-8"
Content-Transfer-Encoding: quoted-printable

I work with quaternios for orientation. This is for convert from =
ode->directX.



D3DXVECTOR3 convertVector(const dReal *in)

{

D3DXVECTOR3 out;

out.x=3D(float) in[0];

out.y=3D(float) in[1];

out.z=3D(float) in[2];

return out;

}

D3DXQUATERNION convertQuaternion(const dReal *in)

{

D3DXQUATERNION out;

out.x=3D(float)in[1];

out.y=3D(float)in[2];

out.z=3D(float)in[3];

out.w=3D(float)in[0];

return out;

}

  ----- Original Message -----=20
  From: Jes=C3=BAs P. Salas=20
  To: ode@q12.org=20
  Sent: Tuesday, March 18, 2003 6:09 PM
  Subject: [ODE] Using ODE with DirectX


  Hi there...

  I want to use ODE with DirectX, ( yes, from Microsoft ;-) ),=20
  the problem I have is the matrix result=20
  I get from dGeomGetRotation() function,=20
  I suppose that matrix is Right-handed ( OpenGL )=20
  but I need it on Left-handed ( DirectX ) Coordinate system,=20
  or symply the angles of the rotation around x,y,z axis, I don't know =
if ODE=20
  can give to me that angles in "pure radian" way, so I will be able to=20
  construct my own matrix

  When I try to use that matrix directly into DX, the movement=20
  of the objects is wrong, ..

  anyon have deal with this problem out there??


  Thanks in advance..


  Jes=C3=BAs Salas
  jsalas@renacimiento.com

------=_NextPart_000_0014_01C2ED92.889BB870
Content-Type: text/html;
	charset="utf-8"
Content-Transfer-Encoding: quoted-printable

=EF=BB=BF<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dutf-8">
<META content=3D"MSHTML 6.00.2800.1141" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>
<P>I work with quaternios for orientation. This is for convert from=20
ode-&gt;directX.</P>
<P>&nbsp;</P>
<P>D3DXVECTOR3 convertVector(</FONT><FONT color=3D#0000ff =
size=3D2>const</FONT><FONT=20
size=3D2> dReal *in)</P>
<P>{</P>
<P>D3DXVECTOR3 out;</P>
<P>out.x=3D(</FONT><FONT color=3D#0000ff size=3D2>float</FONT><FONT =
size=3D2>)=20
in[0];</P>
<P>out.y=3D(</FONT><FONT color=3D#0000ff size=3D2>float</FONT><FONT =
size=3D2>)=20
in[1];</P>
<P>out.z=3D(</FONT><FONT color=3D#0000ff size=3D2>float</FONT><FONT =
size=3D2>)=20
in[2];</P>
<P></FONT><FONT color=3D#0000ff size=3D2>return</FONT><FONT size=3D2> =
out;</P>
<P>}</P>
<P>D3DXQUATERNION convertQuaternion(</FONT><FONT color=3D#0000ff=20
size=3D2>const</FONT><FONT size=3D2> dReal *in)</P>
<P>{</P>
<P>D3DXQUATERNION out;</P>
<P>out.x=3D(</FONT><FONT color=3D#0000ff size=3D2>float</FONT><FONT =
size=3D2>)in[1];</P>
<P>out.y=3D(</FONT><FONT color=3D#0000ff size=3D2>float</FONT><FONT =
size=3D2>)in[2];</P>
<P>out.z=3D(</FONT><FONT color=3D#0000ff size=3D2>float</FONT><FONT =
size=3D2>)in[3];</P>
<P>out.w=3D(</FONT><FONT color=3D#0000ff size=3D2>float</FONT><FONT =
size=3D2>)in[0];</P>
<P></FONT><FONT color=3D#0000ff size=3D2>return</FONT><FONT size=3D2> =
out;</P>
<P>}</P></FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV=20
  style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
  <A title=3Djsalas@renacimiento.com =
href=3D"mailto:jsalas@renacimiento.com">Jes=C3=BAs=20
  P. Salas</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A title=3Dode@q12.org=20
  href=3D"mailto:ode@q12.org">ode@q12.org</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Tuesday, March 18, 2003 =
6:09=20
  PM</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> [ODE] Using ODE with=20
  DirectX</DIV>
  <DIV><BR></DIV>
  <DIV>Hi there...</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>I want to use ODE with DirectX, ( yes, from Microsoft ;-) ), =
</DIV>
  <DIV>the problem I have is the matrix result </DIV>
  <DIV>I get from dGeomGetRotation() function, </DIV>
  <DIV>I suppose that matrix is Right-handed ( OpenGL ) </DIV>
  <DIV>but I need it on Left-handed ( DirectX ) Coordinate system, =
</DIV>
  <DIV>or symply the angles of the rotation around x,y,z axis, I don't =
know if=20
  ODE </DIV>
  <DIV>can give to me that angles in "pure radian" way, so I will be =
able to=20
  </DIV>
  <DIV>construct my own matrix</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>When I try to use that matrix directly into DX, the movement =
</DIV>
  <DIV>of the objects is wrong, ..</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>anyon have deal with this problem out there??</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>Thanks in advance..</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>Jes=C3=BAs Salas</DIV>
  <DIV><A=20
href=3D"mailto:jsalas@renacimiento.com">jsalas@renacimiento.com</A></DIV>=

  <DIV>&nbsp;</DIV></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0014_01C2ED92.889BB870--