Recommended Posts

I cant seem to figure out how to make how to view the whole of the plane and not just right close it to , if you look at the DirectX sample MultiAnimation i want it like that, thats where i got this code from btw, if anyone can help with this problem that would be great.

D3DXMATRIX matRotateY,matTrans; // a matrix to store the rotation for each triangle
//D3DXMatrixRotationY(&matRotateY, index); // the rotation matrix
D3DXMatrixTranslation(&matTrans,0.0f,0.0f,vCharPos.z);
D3DXMatrixScaling(&mScale,-0.01f,-0.01f,-0.01f);
d3ddev->SetTransform(D3DTS_WORLD, &(matTrans)); // set the world transform

// draw the spaceship
for(DWORD i = 0; i < numMaterials; i++) // loop through each subset
{
d3ddev->SetMaterial(&material); // set the material for the subset
if(texture != NULL) // if the subset has a texture (if texture is not NULL)
d3ddev->SetTexture(0, texture); // ...then set the texture

Share this post

Link to post

Share on other sites

i put D3DXVECTOR3 vCharPos(0.0f,0.0f,0.0f);
that is going to lock the positon always to that value so i dont think that will work

dt is the timer stuff

Well, your code changes the Z position based on 5.0*dt, so no - it won't lock it to that unless you want it to.

The point is that you cannot have any uninitialised variables anywhere in your code or all bets are off. All varaibles need to be initialised to known values; the exact value they're initialised to depends entirely on your code.

My point about dt was - what is the value of it? Is it 0? 9000.473? Because your fat clip plane is set to 100 units, so you need to make sure everything is within that distance.

Share this post

Link to post

Share on other sites

[quote name='Anddos' timestamp='1332349802' post='4924007']
i put D3DXVECTOR3 vCharPos(0.0f,0.0f,0.0f);
that is going to lock the positon always to that value so i dont think that will work

dt is the timer stuff

Well, your code changes the Z position based on 5.0*dt, so no - it won't lock it to that unless you want it to.

The point is that you cannot have any uninitialised variables anywhere in your code or all bets are off. All varaibles need to be initialised to known values; the exact value they're initialised to depends entirely on your code.

My point about dt was - what is the value of it? Is it 0? 9000.473? Because your fat clip plane is set to 100 units, so you need to make sure everything is within that distance.
[/quote]

if i add D3DXVECTOR3 vCharPos(0.0f,0.0f,0.0f);
and look at the output positon then its locked to the same poistion and its obvious it would do that as its in the render loop

the dt value is ever changing, theres no set value

0

Share this post

Link to post

Share on other sites

So you now have:
D3DXVECTOR3 vCharPos(0.0f,0.0f,0.0f);
D3DXVECTOR3 vCharFacing(0.0f,0.0f,-1.0f); //facing down -z;
vCharPos.x = 0.0f; vCharPos.y; vCharPos.z -= 5.0f * dt;Right? Then vCharPos.z is changing based on the value of dt, it shouldn't be locked to the same value.