• Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

### #Actualgnomgrol

Posted 05 July 2012 - 06:49 AM

Hello guys, im getting a pretty wierd problem.
When I try to move my model by changing its worldmatrix, it gets draw some frames at the 0 0 0 position, and some other frams as totally messed up something. Same for rotation, but scaling works fine.

[source lang="cpp"]D3DXMatrixIdentity(&World);D3DXVECTOR3 rotaxisX = D3DXVECTOR3(1.0f, 0.0f, 0.0f);D3DXVECTOR3 rotaxisY = D3DXVECTOR3(0.0f, 1.0f, 0.0f);D3DXVECTOR3 rotaxisZ = D3DXVECTOR3(0.0f, 0.0f, 1.0f);D3DXMATRIX temprot1, temprot2, temprot3; D3DXMatrixRotationAxis(&temprot1, &rotaxisX, 0); D3DXMatrixRotationAxis(&temprot2, &rotaxisY, 0); D3DXMatrixRotationAxis(&temprot3, &rotaxisZ, 0);Rotation = temprot1 *temprot2 * temprot3;D3DXMatrixTranslation(&Translation, 0.0f, 10.0f, 0.0f);D3DXMatrixScaling(&Scale, 0.02f, 0.02f, 0.02f);//Set objs world space using the transformationsWorld = Translation * Rotation * Scale;[/source]

[source lang="cpp"]cbuffer cbPerObject{ matrix worldMatrix; matrix viewMatrix; matrix projectionMatrix;};// Change the position vector to be 4 units for proper matrix calculations.input.position.w = 1.0f; // Calculate the position of the vertex against the world, view, and projection matrices. output.position = mul(input.position, worldMatrix); output.position = mul(output.position, viewMatrix); output.position = mul(output.position, projectionMatrix);[/source]

I really cant see what is going wrong here. If all matrixchanges are 0, then its drawn fine.
Has it something to do with the math? The constantbuffer is set fine thought, light is set the same way and it works fine.

It looks like this (switching between these two frames randomly, ignore the terrain):
http://imageshack.us...3/32408839.png/
http://imageshack.us.../42/failjf.png/

### #2gnomgrol

Posted 05 July 2012 - 06:49 AM

Hello guys, im getting a pretty wierd problem.
When I try to move my model by changing its worldmatrix, it gets draw some frames at the 0 0 0 position, and some other frams as totally messed up something. Same for rotation, but scaling works fine.

[source lang="cpp"]D3DXMatrixIdentity(&World);D3DXVECTOR3 rotaxisX = D3DXVECTOR3(1.0f, 0.0f, 0.0f);D3DXVECTOR3 rotaxisY = D3DXVECTOR3(0.0f, 1.0f, 0.0f);D3DXVECTOR3 rotaxisZ = D3DXVECTOR3(0.0f, 0.0f, 1.0f);D3DXMATRIX temprot1, temprot2, temprot3; D3DXMatrixRotationAxis(&temprot1, &rotaxisX, 0); D3DXMatrixRotationAxis(&temprot2, &rotaxisY, 0); D3DXMatrixRotationAxis(&temprot3, &rotaxisZ, 0);Rotation = temprot1 *temprot2 * temprot3;D3DXMatrixTranslation(&Translation, 0.0f, 10.0f, 0.0f);D3DXMatrixScaling(&Scale, 0.02f, 0.02f, 0.02f);//Set objs world space using the transformationsWorld = Translation * Rotation * Scale;[/source]

[source lang="cpp"]cbuffer cbPerObject{ matrix worldMatrix; matrix viewMatrix; matrix projectionMatrix;};// Change the position vector to be 4 units for proper matrix calculations.input.position.w = 1.0f; // Calculate the position of the vertex against the world, view, and projection matrices. output.position = mul(input.position, worldMatrix); output.position = mul(output.position, viewMatrix); output.position = mul(output.position, projectionMatrix);[/source]

I really cant see what is going wrong here. If all matrixchanges are 0, then its drawn fine.
Has it something to do with the math? The constantbuffer is set fine thought, light is set the same way and it works fine.

It looks like this (switching between these two frames randomly):
http://imageshack.us/photo/my-images/3/32408839.png/
http://imageshack.us/photo/my-images/42/failjf.png/

### #1gnomgrol

Posted 05 July 2012 - 06:19 AM

Hello guys, im getting a pretty wierd problem.
When I try to move my model by changing its worldmatrix, it gets draw some frames at the 0 0 0 position, and some other frams as totally messed up something. Same for rotation, but scaling works fine.

[source lang="cpp"]D3DXMatrixIdentity(&World);D3DXVECTOR3 rotaxisX = D3DXVECTOR3(1.0f, 0.0f, 0.0f);D3DXVECTOR3 rotaxisY = D3DXVECTOR3(0.0f, 1.0f, 0.0f);D3DXVECTOR3 rotaxisZ = D3DXVECTOR3(0.0f, 0.0f, 1.0f);D3DXMATRIX temprot1, temprot2, temprot3;    D3DXMatrixRotationAxis(&temprot1, &rotaxisX, 0);    D3DXMatrixRotationAxis(&temprot2, &rotaxisY, 0);    D3DXMatrixRotationAxis(&temprot3, &rotaxisZ, 0);Rotation = temprot1 *temprot2 * temprot3;D3DXMatrixTranslation(&Translation, 0.0f, 10.0f, 0.0f);D3DXMatrixScaling(&Scale, 0.02f, 0.02f, 0.02f);//Set objs world space using the transformationsWorld = Translation * Rotation * Scale;[/source]