   Firing bullets problem
  I am rendering box's which are fired out in the ships direction first i check is space pressedif(fire){//MessageBox(NULL,"Fire","",0);VecStruct vs;vs.Dir = rRotToDir;vs.FPos = FinalPos;Vs.push_back(vs);fire = false;}then here loop on vector size, the trouble is each box spawns at the last distance , so i am stuck with this time thing , like how would you reset it without messing anything up so bullets spawn from the ships center.for(int i = 0; i < Vs.size(); i++){D3DXMatrixTranslation(&Vs.Pos,Vs.Dir.x*gTimeDelta*5.5f,    Vs.Dir.y*gTimeDelta*5.5f, Vs.Dir.z*gTimeDelta*5.5f);d3ddev->SetTransform(D3DTS_WORLD,&Vs.Pos);Box->DrawSubset(0);}heres a video of what i mean
  The tags you're looking for are [source][/source] (also, be sure to match them up correctly).   ;  ive got that sorted now what i want next is a ray to move with the bullet in the pushed back drection but when i fire say in the oposite direction it says intersected , do you know why?ive tried thisD3DXVec3TransformNormal(&NormDir,&Vs.Dir,D3DXMatrixInverse(NULL,NULL,&(matWorld * matView)));D3DXVec3Normalize(&NormDir,&NormDir);but dosent seem to work , that converts the ray to objectspace (same space as the wall)[Edited by - Anddos on May 18, 2010 1:16:08 PM];Quote:Original post by Anddosive got that sorted now what i want next is a ray to move with the bullet in the pushed back drection but when i fire say in the oposite direction it says intersected , do you know why?Is it intersecting with the bullet itself or the ship? I use rays for my missiles and the ray would intersect with the missile itself (making it think its hit something and blow up). Either ignore the bullet itself when checking or make the ray origin forward of the bullet slightly.   ;Quote:Original post by NanohaQuote:Original post by Anddosive got that sorted now what i want next is a ray to move with the bullet in the pushed back drection but when i fire say in the oposite direction it says intersected , do you know why?Is it intersecting with the bullet itself or the ship? I use rays for my missiles and the ray would intersect with the missile itself (making it think its hit something and blow up). Either ignore the bullet itself when checking or make the ray origin forward of the bullet slightly.the bullet is intersecting with the wall no matter which rotation i fire from....short videoD3DXVECTOR3 ObjPos,NormDir;D3DXMATRIX matWorld;d3ddev->GetTransform(D3DTS_WORLD,&matWorld);for(int i = 0; i < Vs.size(); i++){D3DXMatrixTranslation(&Vs.Pos,Vs.Dir.x*(gTimeDelta-Vs.BulletTime)*5.0f,    Vs.Dir.y*(gTimeDelta-Vs.BulletTime)*5.0f, Vs.Dir.z*(gTimeDelta-Vs.BulletTime)*5.0f);d3ddev->SetTransform(D3DTS_WORLD,&Vs.Pos);D3DXVECTOR3 BPos(Vs.Pos._41,Vs.Pos._42,Vs.Pos._43);//Vs.Pos._43 = -5.0f;//MadeEffect->Begin(NULL, NULL);    // begin using the effect//MadeEffect->BeginPass(0);    // begin the pass//MadeEffect->SetMatrix("World",&Vs.Pos);Box->DrawSubset(0);//gotta convert the ray to objectspace same space as the wallD3DXVec3TransformCoord(&ObjPos,&BPos,D3DXMatrixInverse(NULL,NULL,&(matWorld * matView))); // to object space positionD3DXVec3TransformNormal(&NormDir,&Vs.Dir,D3DXMatrixInverse(NULL,NULL,&(matWorld * matView))); // to object space directionD3DXVec3Normalize(&NormDir,&NormDir);D3DXIntersect(Wall,&BPos,&NormDir,&Hit,&Face,NULL,NULL,&Dist,NULL,0);if(Hit){d3ddev->SetRenderState(D3DRS_LIGHTING, TRUE);d3ddev->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);}else{d3ddev->SetRenderState(D3DRS_LIGHTING, TRUE);d3ddev->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);Face = 0;Hit = false;}[Edited by - Anddos on May 18, 2010 2:38:13 PM]