   rendering a object in the camera direction , such as a weapon?
  I am stuck with how you render a weapon in a fps game so when you yaw , pitch , roll the camera the weapon is rendering in the same direction, thanks if you can help   
  The traditional way is simply to use a separate camera for the world and the first-person-weapon.e.g. for the world, you have translation+rotation(pitch/yaw/roll) included in your view-matrix, but before you render the gun, you reset the view-matrix to identity.   ;  but you can only SetTransform(VIEW) once tho right?   ;Quote:Original post by Anddosbut you can only SetTransform(VIEW) once tho right?You can set any transform any number of times per frame you like.   ;  in this source code i am looking at there is no where where it sets the VIEW matrix , just builds a camera with the 3 vectors like this so i am confused about why it dosent setTransform(VIEW)? also where would the best place to render a gun model because i cant get the inverse of view because its not set :)void Camera::update(float dt, Terrain* terrain, float offsetHeight){// Find the net direction the camera is traveling in (since the// camera could be running and strafing).D3DXVECTOR3 dir(0.0f, 0.0f, 0.0f);if( gDInput->keyDown(DIK_W) )dir += mLookW;if( gDInput->keyDown(DIK_S) )dir -= mLookW;if( gDInput->keyDown(DIK_D) )dir += mRightW;if( gDInput->keyDown(DIK_A) )dir -= mRightW;//if( gDInput->keyDown(DIK_R) )//dir -= mUpW;static float y = 2.5f;if( gDInput->keyDown(DIK_SPACE)) {y += 0.5f;}// Move at mSpeed along net direction.D3DXVec3Normalize(&dir, &dir);D3DXVECTOR3 newPos = mPosW + dir*mSpeed*dt;if( terrain != 0){// New position might not be on terrain, so project the// point onto the terrain.newPos.y = terrain->getHeight(newPos.x, newPos.z) + offsetHeight;// Now the difference of the new position and old (current) // position approximates a tangent vector on the terrain.D3DXVECTOR3 tangent = newPos - mPosW;D3DXVec3Normalize(&tangent, &tangent);// Now move camera along tangent vector.mPosW += tangent*mSpeed*dt;// After update, there may be errors in the camera height since our// tangent is only an approximation.  So force camera to correct height,// and offset by the specified amount so that camera does not sit// exactly on terrain, but instead, slightly above it.mPosW.y = terrain->getHeight(mPosW.x, mPosW.z) + offsetHeight;}else{mPosW = newPos;}static float pitch;static float yAngle;//if mouse button down then rotateif(gDInput->mMouseState.rgbButtons[0] == 0x80) //Left mouse down{// We rotate at a fixed speed.pitch  = gDInput->mouseDY() / 30.0f;yAngle = gDInput->mouseDX() / 30.0f;}// Rotate camera's look and up vectors around the camera's right vector.D3DXMATRIX R;D3DXMatrixRotationAxis(&R, &mRightW, pitch);D3DXVec3TransformCoord(&mLookW, &mLookW, &R);D3DXVec3TransformCoord(&mUpW, &mUpW, &R);// Rotate camera axes about the world's y-axis.D3DXMatrixRotationY(&R, yAngle);D3DXVec3TransformCoord(&mRightW, &mRightW, &R);D3DXVec3TransformCoord(&mUpW, &mUpW, &R);D3DXVec3TransformCoord(&mLookW, &mLookW, &R);// Rebuild the view matrix to reflect changes.buildView();mViewProj = mView * mProj;}void Camera::buildView(){// Keep camera's axes orthogonal to each other and of unit length.D3DXVec3Normalize(&mLookW, &mLookW);D3DXVec3Cross(&mUpW, &mLookW, &mRightW);D3DXVec3Normalize(&mUpW, &mUpW);D3DXVec3Cross(&mRightW, &mUpW, &mLookW);D3DXVec3Normalize(&mRightW, &mRightW);// Fill in the view matrix entries.float x = -D3DXVec3Dot(&mPosW, &mRightW);float y = -D3DXVec3Dot(&mPosW, &mUpW);float z = -D3DXVec3Dot(&mPosW, &mLookW);mView(0,0) = mRightW.x; mView(1,0) = mRightW.y; mView(2,0) = mRightW.z; mView(3,0) = x;   mView(0,1) = mUpW.x;mView(1,1) = mUpW.y;mView(2,1) = mUpW.z;mView(3,1) = y;  mView(0,2) = mLookW.x; mView(1,2) = mLookW.y; mView(2,2) = mLookW.z; mView(3,2) = z;   mView(0,3) = 0.0f;mView(1,3) = 0.0f;mView(2,3) = 0.0f;mView(3,3) = 1.0f;};  Your original question, I believe, was primarily about drawing the weapon essentially in the same position on the screen, independent of the camera direction. What Hodgman and Evil Steve are saying is: draw the scene using the camera view, change the view, then draw the weapon in the same position on the screen each frame. Then, for weapon firing, etc., just assume the weapon is pointed in the same direction as the camera view, but perhaps with a different position.   ;  I dont understand buckeye , do you have any code of what you mean   ;  I don't have any code doing that. Did you re-read Hodgman's post?   