• Advertisement
Sign in to follow this  

3d coordinates

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to point the mouse at certain position on the screen and fed back with its x,y,z, positions of the scene, just like 3dsmax In the VB, where 2D is the case, I can create 2 textboxes and code them like this sub mouse_click (X as long, Y as long...) text1.text = Str(X) text2.text = Str(Y) end sub How to do it? but in C++ Thanks Jack

Share this post


Link to post
Share on other sites
Advertisement
The DirectX SDK has a picking example. You can also search the forums or google for picking examples.

Chris

Share this post


Link to post
Share on other sites
Hi Chris,
The picking example from DX9 only works on triangles of a mesh.
I want to 'pick' the world coordinate positions... Thanks
Just like when I rollover some point in the world space, I can get the x,y,z positions of where my mouse pointing at immediately.
Jack

Share this post


Link to post
Share on other sites
I have used this function to place a mesh where the mouse is in a perspective viewport.

D3DXVec3Unproject( _
VOut As D3DVECTOR, _
V As D3DVECTOR, _
Viewport As D3DVIEWPORT8, _
Projection As D3DMATRIX, _
View As D3DMATRIX, _
World As D3DMATRIX)

Projects a vector from screen space into object space. Search this function in the DirectX SDK.

Share this post


Link to post
Share on other sites
I'm a little confused. You can't get a z value unless you have something that the mouse pointer is intersecting. Are you just interested in the x and y values? Or are you assuming an invisible plane at Z=0 and this is what you want to get the z value from? If that is the case, you can use a pick example and just use a quad lying in the z=0 plane for the test (instead of a mesh). You could then optimize from there.

Chris

Share this post


Link to post
Share on other sites
Actually, I am wanting to pick two vectors and record them and let the object moves along by interpolation....
Am I on the right track? or anyone suggests a better solution?
Thanks
Jack

Share this post


Link to post
Share on other sites
I remember the game "Age of Empire", of that when you click in orth. view, the characters could still move to the correct positions although it is in 3d space. Am I correct?
Thanks
Jack

Share this post


Link to post
Share on other sites
If the object will be moving in the same z plane, then you can achieve this by making that invisible z=0 plane into a z=Some Value plane, where some value is the center z value of the object you want to slide around.

Chris

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement