Sign in to follow this  
lucky7456969

3d coordinates

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
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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this