Jump to content

  • Log In with Google      Sign In   
  • Create Account


ThePointingMan

Member Since 09 Nov 2010
Offline Last Active Yesterday, 12:43 PM
-----

#5050158 Converting the mouse position to

Posted by ThePointingMan on 04 April 2013 - 05:40 PM

Firstly, thankyou very much Slice4Ever andEndurion, you two have been a great help. I'm still having a wee bit of trouble with the Unproject function though. D3d's unproject looks like this

 

 

D3DXVECTOR3* D3DXVec3Unproject(
_Inout_  D3DXVECTOR3 *pOut,
_In_     const D3DXVECTOR3 *pV,
_In_     const D3D10_VIEWPORT *pViewport,
_In_     const D3DXMATRIX *pProjection,
_In_     const D3DXMATRIX *pView,
_In_     const D3DXMATRIX *pWorld
);
 

As far as I can tell I should be putting the vector holding the mouse co-ords for pV,

the projection matrix and view matrix in their places,

but I'm unsure as to what I should be putting in the ViewPort section and pWorld. Honestly I don't even fully understand what a view port is!

 

Edit: Alright, funny that trying to setup the mouse would teach me so much about the camera, at one point I ended up accidentally turning my level editor into a first person shooter! Minus the bullets of course :/ I understand what the view port is now, all is good! Thank you all for your help! For others who may come across this issue, here is something that helped me out a bit. an example of what this should look like using directx's functions http://gamedev.stackexchange.com/questions/44364/zooming-into-mouse-position and MSDN's page on viewports http://msdn.microsoft.com/en-ca/library/windows/desktop/bb206341(v=vs.85).aspx

 

Edit*2: I have noticed one slight error though, I remember dealing with this with my last project but I don't quite remember how. The WS style SYSMENU includes a little bar at the top of the screen, and this is interfering with my mouse position, does anyone know of any ways to work around this?




PARTNERS