   FPS Weapon Positioning
Hi there, I've got a first person camera. Yay me! I've also got a sweet model of a Mac11 that I position on the lookAt vector of my camera. Its always in front of the camera. Trouble is, I can't figure out how to get it to always be facing 'forward'.How do I do this? I've done getting the cameras current rotation values and multiplying by that, but then what I get is a wildly spinning Mac11.. no use to anyone lol I read something [on here] about setting the view matrix to the identity, or to the world matrix, so that the camera and gun are in the same space, so to speak. Can someone clear this idea up for me please?Please help, many thanks in advance.
Try multiplying the models worldmatrix with the cameras viewmatrix every frame. this should result in "childing" the model to the camera.;Try multiplying the models worldmatrix with the cameras viewmatrix every frame. this should result in "childing" the model to the camera. Sounds sweet.. m_mainCam->GetViewMatrix( view );   // actual view matrixgunPos = m_mainCam->GetLookAt();    // is just in front of the cameragunMat = playerGun->GetModelMatrix();    //.. model, view, proj sent to shaderD3DXMatrixTranslation( &gunMat, gunPos.x, gunPos.y, gunPos.z ); playerGun->SetModelMatrix( gunMat * view ); // on render we use the private m_modelMatrix, and pass in view and proj It almost works.. it's not spinning so  wildly.. the rotation looks like it's definitely relative to the camera now,but now it's not placed in front of my camera anymore.Can you give me another nudge kind sir?Thanks ;if you're trying to draw it like you're holding it in front of you aiming it, you need to first transform it out to where it should be in relation to the player, and then transform it out to the player's location and orientation in the world. so first you turn it so its pointing away from you, then you move it up to where your hand is. then you apply the player's orientation, so it turns with the player, then you apply the players translation, to move it out where it should be in the world. do a search on "nested frames of reference" for more info.