Thread: Directx D3DXMatrixLookAtLH prob?

  1. #1
    Registered User
    Join Date
    Aug 2002

    Unhappy Directx D3DXMatrixLookAtLH prob?


    where to start....

    well I am writing a simple program to load X files, In the program i have setup several functions for camera movement...

    now based on the users input, i have setup these functions to adjust the camera source/target accordingly through the D3DXMatrixLookAtLH function, then pass the D3DXMATRIX through the g_pD3D->SetTransform(D3DTS_VIEW, &matView);

    now my prob is when i pass the D3DXVERTEX3 variable as the source in the D3DXMatrixLookAtLH function, being the second parameter, it tells me that it is expecting a constant expression instead of a literal expresion.

    also with the error it says that no user defined operator is given to make the conversion, or operator cannot be called.

    sorry for the sparactic thought, i haven't sleep in what feels like days!

    anyway here is the code snipplet:
    void vSetupView()
    	D3DXMATRIX	m;
    	D3DXMATRIX	matView;
    	D3DXMATRIX	matRotate;
    	D3DXMATRIX	matProj;
    	D3DXVECTOR3	matSource;
    	D3DXVECTOR3	matTarget;
    	D3DXMatrixRotationX(&m, xRotation); 
                    matRotate = matRotate * m;
    	D3DXMatrixRotationY(&m, yRotation);  
                    matRotate = matRotate * m;
    	D3DXMatrixRotationZ(&m, xRotation); 
                    matRotate = matRotate * m;
    	//set zoom and height strafe
    	matSource.x = xAdjust;
    	matSource.y = yAdjust;
    	matSource.z = -30.0f;
    	matTarget.x = xAdjust;
    	matTarget.y = yAdjust;
    	matTarget.z = 0.0f;
    	matSource.x = matSource.x + (Zoom * (matTarget.x -                matSource.x));
    	matSource.y = matSource.y + (Zoom * (matTarget.y -                matSource.y));
    	matSource.z = matSource.z + (Zoom * (matTarget.z -                matSource.z));
    	matTarget.x = matTarget.x + (Zoom * (matTarget.x -                matSource.x));
    	matTarget.y = matTarget.y + (Zoom * (matTarget.y -                matSource.y));
    	matTarget.z = matTarget.z + (Zoom * (matTarget.z -                matSource.z));
    	D3DXMatrixLookAtLH( &matView, matSource,
    								  D3DXVECTOR3(0.0f, 1.0f, 0.0f);
    	matView = matView * matRotate;
    	D3DXMatrixPerspectiveFovLH                                                           (&matProj, D3DX_PI/4, 1.0f, 1.0f, 500.0f);
                                              (D3DTS_VIEW, &matView);
                                        (D3DTS_PROJECTION, &matProj);
    that is it...

    well any help is appreciated, i know it is something simple and i am not thinking right now, thanks frog22

    We'd enjoy it more if it had code tags. Hammer

  2. #2
    Registered User
    Join Date
    Apr 2002
    You forgot a paranthesis on the call to D3DXMatrixLookAtLH.

  3. #3
    Registered User
    Join Date
    Aug 2002

    unfortanuately that didn't work

    sorry that wasn't it, althought thank you for the reply anyway!!

  4. #4
    Registered User
    Join Date
    Apr 2002
    For the same call , you need to pass the address of the variables...for example..

    D3DXMatrixLookAtLH( &mat1, &mat2, &mat3, &D3DXVector3( 1.0f, 2.0f, 3.0f ) );

  5. #5
    Registered User
    Join Date
    Aug 2002

    lol sleep is a definate nessity

    well that was it.... lol i have spent the last 2 hours going over the prob and that was it.

    thanks mr wizard...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Isometric Tile Engine using DirectX
    By Wraithan in forum Game Programming
    Replies: 3
    Last Post: 07-17-2006, 12:16 PM
  2. DirectSound header issues
    By dxfoo in forum C++ Programming
    Replies: 0
    Last Post: 03-19-2006, 07:16 PM
  3. DirectX - Starting Guide?
    By Zeusbwr in forum Game Programming
    Replies: 13
    Last Post: 11-25-2004, 12:49 AM
  4. DirectX 8 with Borland
    By Tommaso in forum Game Programming
    Replies: 11
    Last Post: 08-12-2003, 09:30 AM
  5. Directx SDK Documentation
    By Zoalord in forum Game Programming
    Replies: 4
    Last Post: 05-08-2003, 06:07 AM