initializing an LPD3DVECTOR

This topic is 3414 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Well, this one is pretty quick and dirty, but I didn't succeed in solving it myself. All I'm trying is to get the position of my camera in direct3d (C++), and for that I need an LPD3DVECTOR... sure, no problem. I define one at the beginning of my function. But the camera.GetPosition(LPDIRECT3DRMFRAME3 reference, LPD3DVECTOR return-position) wants the vector allready initialised. I know how to initialise standard datatypes, but how do I initialise a LPD3DVECTOR? simply initialising it with NULL doesn't help, the SDK documentation refused to be of much help and I didn't find the problem on the net either. I guess it's really a trivial problem anyone with an apropriate bit of C++ expirience knows how to deal with, but alas my expirience so far is limited to visual basic, wich didn't exactly teach me much about initialising, pointers etc.

Share on other sites
In this case what you want is a D3DVECTOR, and pass the address of that vector to GetPosition().

Share on other sites
LPD3DVECTOR is defined as a pointer (*) to a D3DVECTOR3 structure.
You can declare a variable which has the structure type:

D3DVECTOR3 vec;

and use the address-of operator (&) to get a pointer to that:

camera.GetPosition(reference, &vec);

EDIT: like SiCrane said.

Share on other sites
Works perfectly, thank you very much!

• 10
• 19
• 14
• 19
• 15