A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by ledahut » Tue Nov 09, 2010 3:46 am
Post your code from NewtonBodySetTransform callback please
-
ledahut
-
- Posts: 98
- Joined: Mon Jun 21, 2010 8:03 am
- Location: France
by JernejL » Tue Nov 09, 2010 8:16 am
Berserkguard wrote:Hello,
I remember reading that Newton uses row-major matrices while OpenGL uses column-major matrices... I've tried transposing between the matrix swapping from Newton to OpenGL, but that didn't work; I also remember reading that you don't need to transpose matrices between OpenGL and Newton since they are the same format..? Which one are they?
Do not lose time thinking about that, the DATA itself is SAME and Binary compatible for both type of matrixes, the row/column difference is simply notation on how the data is visualized.
If you use newtonbodysetmatrix, the matrix should position the object properly, are you sure the newton body isn't in correct place? perhaps it is just that you haven't retrieved body's matrix back when you visualized it, inspect the data that you sent the correct matrix translation components.
-

JernejL
-
- Posts: 1587
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by Julio Jerez » Tue Nov 09, 2010 9:16 am
I thought I posted here before. Maybe I post in teh wrong thread.
I said, the position is the last row of a 4 x 4 array of float, as simpel as that.
-
Julio Jerez
- Moderator

-
- Posts: 12452
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Julio Jerez » Tue Nov 09, 2010 10:19 pm
fi the matrix was and 4 x 4 array
float matrix[4][4];
then the position ine
posit_x = matrix[3][0]
posit_y = matrix[3][1]
posit_z = matrix[3][2]
matrix[3][3] must always be 1.0
regaless if d3d or opengl,
so if you cast you matrix to a ptr = (float*) matriox (d3d or OGL
elements 12, 13, 14 are the position
-
Julio Jerez
- Moderator

-
- Posts: 12452
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by JernejL » Wed Nov 10, 2010 3:47 am
Berserkguard wrote:Delfi, the data is undoubtedly the same. But isn't the way columns and rows are treated different for column- and row-major matrices?
Julio Jerez wrote:the position is the last row of a 4 x 4 array of float, as simpel as that.
Yes, in a row-major matrix. But in a column-major matrix, wouldn't the x, y, and z coordinates be in the last column, (_14, _24, and _34), as opposed to last row, (_41, _42, and _43)?
Like i said.. the binary data format is SAME, just use whatever matrix4f definition you use in the engine and it will work fine.
-

JernejL
-
- Posts: 1587
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by Julio Jerez » Wed Nov 10, 2010 7:13 pm
forget abput GameDev.net, Open Gl or D3D, go by your book in lineal algebra.
a matrix is just a 4 x 4 array of float, it is a simple as that.
they some rule to apply to matrix operation, like mutiply, add, etc.
-
Julio Jerez
- Moderator

-
- Posts: 12452
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 212 guests