Sorry, Bob I didn't read the thread enough. Just downloaded it and it works fine.
Some key issues/suggestions:
- Screen flickers. My eye is catching the refresh rate which probably means you are in the 60hz range or you are using an off the wall refresh rate. Might I suggest using the default desktop refresh rate since that is what most games do?
- The skybox cube looks great and no seams which is cool. I have a program which will enable you to create six textures from one flat one...and it will auto-distort the images so you don't have to mess with it. So you can make any image your skybox with no seams.
- Third person camera. I know you said you don't want to do it but it is not much more code. Just test the camera variable and if it's third person simply translate out from the object first and then render as normal.
Core render function
Code:
void CObjectMgr::Render()
{
CGameObject *pObject=m_vObjects[m_dwCameraObject];
D3DXMatrixIdentity(&pObject->m_matWorld);
D3DXMATRIX matView;
D3DXMATRIX matInvView;
int iViewMode=pObject->m_spMyCamera->GetViewMode();
if (iViewMode==COCKPIT || iViewMode==CHASE)
{
pObject->m_bInFlyBy=false;
m_spDevice->GetTransform(D3DTS_VIEW,&matView);
D3DXMatrixInverse(&matInvView,NULL,&matView);
if (iViewMode==COCKPIT)
{
D3DXMATRIX matTrans;
D3DXMatrixTranslation(&matTrans,0.0f,-2.0f,0.0f);
pObject->m_matWorld=matTrans*matInvView;
}
if (iViewMode==CHASE)
{
D3DXMATRIX matTrans;
D3DXMatrixTranslation(&matTrans,0.0f,-7.0f,25.0f);
pObject->m_matWorld=matTrans*matInvView;
}
}
//Third person camera or flyby camera
if (iViewMode==OBJECT || iViewMode==FLYBY)
{
D3DXMATRIX matRot;
pObject->m_pOrient->GetViewMatrix(&matRot);
D3DXVECTOR3 vecPos;
pObject->m_pOrient->GetPosition(&vecPos);
D3DXMATRIX matTrans;
D3DXMatrixTranslation(&matTrans,vecPos.x,
vecPos.y,
vecPos.z);
pObject->m_matWorld=matRot*matTrans;
}
//If we are in FLYBY we also need a new matrix
//Compute new matrix and offset camera randomly from ship velocity vector for flyby effect
if (iViewMode==FLYBY)
{
if (pObject->m_bInFlyBy==false)
{
pObject->m_bInFlyBy=true;
D3DXVECTOR3 vecCamPos,vecRight,vecLook,vecUp;
vecCamPos=pObject->m_pOrient->GetPosition();
//Translate along right vector just a bit
float m_fX=0.0f,m_fY=0.0f;
vecRight=pObject->m_pOrient->GetRight();
vecUp=pObject->m_pOrient->GetUp();
int iNum=rand()%50;
if (iNum<25)
{
vecCamPos+=vecRight*14.0f;
} else vecCamPos+=(-vecRight*14.0f);
iNum=rand()%50;
if (iNum<25)
{
vecCamPos+=vecUp*7.0f;
} else vecCamPos+=(-vecUp*7.0f);
//Translate camera ahead of the ship along it's look vector
vecLook=pObject->m_pOrient->GetLook();
//If object is not moving, translate away a bit so camera is not inside of object
if (pObject->m_fSpeed==0.0f)
{
vecCamPos+=vecLook*(10.0f);
} else vecCamPos+=vecLook*(pObject->m_fSpeed*4.0f);
pObject->m_spMyCamera->SetPosition(&vecCamPos);
}
}
}
All you need is the OBJECT code section for third person camera. Don't ask me to make the model though cuz I suck.
I like the hovercraft app Bob and the physics are very cool. Hope to see you do more with it. I'm sorta burn out on my app right now so I know how it gets.
And how are you skinning the jeep with that texture? I need to texture my models but am having lots of troubles.