target point of the camera. Here is the code that is invoking the load bullet function describes earlier
//on keypress fireaBullet->LoadBullet(CurrentPos.xPos,CurrentPos.yPos,CurrentPos.zPos, CameraLookPos.x, CameraLookPos.y, CameraLookPos.z);
The currentPos is the currnet position & the cameralookpos is actually whats being passed. The camera look pos is constantly
changed in this piece of code in my setupcamera function
D3DXMATRIX matrixCamera;D3DXVECTOR3 CameraPos(CurrentPos.xPos, CurrentPos.yPos, CurrentPos.zPos); LookPos.x = (float)sin(LookAtAngle);LookPos.y = sinf(LookAtUpAngle);LookPos.z = (float)cos(LookAtAngle); CameraLookPos = LookPos + CameraPos; //add the two vectorsD3DXMatrixLookAtLH(&matrixCamera,&CameraPos, &CameraLookPos, &D3DXVECTOR3(0.0f,1.0f,0.0f)); //Which way is Up??? lpDevice->SetTransform(D3DTS_VIEW, &matrixCamera); D3DXMATRIX matrixProject;//setup the field of view, aspect ratio, near clipping plane, far clipping planeD3DXMatrixPerspectiveFovLH(&matrixProject, D3DX_PI/4,1.0f,1.0f,500.0f);//apply the transformationlpDevice->SetTransform(D3DTS_PROJECTION, &matrixProject);//Set Z buffering enabledlpDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);//set lightinglpDevice->SetRenderState(D3DRS_LIGHTING, TRUE);
About using 2 translation matrices I myself don''t get it as to why 2 matrices are needed. by using just one matric my bullet
just hangs around in midair until the loop terminates. Actually on pressing the fire key and invoking the code above the
following function in my game renderloop is initiated i.e. this is where my bullet actually moves.
//RENDER GAME LOOPif(aBullet->IsLoaded())//GetBulletStat()==LOADED)//if the bullet is loaded { // Shoot i++; aBullet->MoveBullet(i);}
the bullet actually moves on each loop of the render game function. The isLoaded function returns true only after the fire
button has been pressed. The parameter i being passed to the movebullet function is just an increment on the number of
iterations the loop has made. upon reahing the maximum iteration the bullet is removed and variables cleared to original.
this sorta started off as a buildup on some tutorials. The bullet is actually dependent on the render loop for the ''chaneg in
distance'' if I may be allowed to say so . for some reason could the problem be in the render loop on the setcamera function
...