After completing my AI system and getting the rendering system to handle pretty much everything I throw at it something important has surfaced.

Without some type of radar this game will be very annoying. The enemy ships flutter about, roll, turn, yaw, etc,. and it's very easy to lose them. Even with targeting reticles and boxes turned on it will still be no small chore to stay with them. To alleviate some of it I'm using the well known arrows at the edge of the screen to indicate where the target is. But this does not make up for a lack of a radar gauge or indicator.

My first attempts have met with some success but are not perfect. Here is the basic code.

void HUD_Radar::Render()
    D3DXVECTOR3 vecLook = m_pGameSector->GetObject(m_ObjectID)->getOrientControl()->GetLook();
    D3DXVECTOR3 vecRight = m_pGameSector->GetObject(m_ObjectID)->getOrientControl()->GetRight();
    D3DXVECTOR3 vecUp = m_pGameSector->GetObject(m_ObjectID)->getOrientControl()->GetUp();
    D3DXVECTOR3 Pos = m_pGameSector->GetObject(m_ObjectID)->getOrientControl()->GetPosition() 
                      + (-vecLook * 100.0f);
    D3DXMATRIX matGaugeTrans;
    D3DXMATRIX matObject;
    D3DXMATRIX matView;
    matObject(3,0) = 0.0f;
    matObject(3,1) = 0.0f;
    matObject(3,2) = 0.0f;
    D3DXMATRIX matWorld = m_matScale * matObject * matGaugeTrans;




void HUD_Radar::Update(float fTimeDelta)
    int contact_index = 0;
    m_ActualContacts = 0;
    for (size_t i = 0; i < m_pGameSector->GetSize(); ++i)
        if (i != m_ObjectID)
            D3DXVECTOR3 vecContact = m_pGameSector->GetObject(i)->getOrientControl()->GetPosition();
            D3DXVECTOR3 vecLook = m_pGameSector->GetObject(m_ObjectID)->getOrientControl()->GetLook();

            D3DXVECTOR3 vecToContact = vecContact - m_vecEmitterPos;

            float range = (vecToContact.x * vecToContact.x) +
                          (vecToContact.y * vecToContact.y) +
                          (vecToContact.z * vecToContact.z);


            //if (range < m_Range)
                D3DXCOLOR color;
                if (vecToContact.y >= vecLook.y)
                    color = D3DXCOLOR(0.0f,1.0f,0.0f,1.0f);
                    color = D3DXCOLOR(0.0f,0.0f,1.0f,1.0f);

                m_Contacts[contact_index] = Legacy_VertexPD(vecToContact.x,

                m_Contacts[contact_index + 1] = Legacy_VertexPD(0.0f,

                contact_index += 2;
                ++ m_ActualContacts;
                if (contact_index > MAX_CONTACTS) break;
As you can see the render code is a mix mash of a disaster right now. The basic idea is to create vertices based upon the positions of the objects surrounding the 'emitting' object - IE: usually the player's craft. Then I rotate this 'model' I've created to match the orientation of the player's craft. This a point. Eventually the plan is to have contacts with lines leading from the contact to the player's Y coordinate. This will give not just directional information but also height information. So contacts above you have lines leading down to the center and contacts below you have lines leading up to the center.

As long as the indicator is in the dead center of the screen everything works. The instant I translate the gauge elsewhere the radar contact lines still try to point at the object. In other words if a spacecraft is dead ahead and level with you the line and contact should be dead ahead of you on the display - regardless of where the indicator actually is inside the cockpit of your ship.

Any ideas why this is happening?