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]
Shader looks like this:
[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/
Edited by gnomgrol, 05 July 2012 - 06:49 AM.







