How detect the mouse 3D position on a viewPort 3D?
#1
I need to find what is the point3D position of the mouse in order to copy or move the object to that position.
How detect the Point 3D position of the mouse on the viewPort?
#2
You have multiple options to do that.

If you want to get the 3D point from a 3D object that is behind the mouse, then use hit-testing. The easiest way to do that is to use standard WPF's hit testing. This is demonstrated in the "EventManager3D / Standard WPF hit testing" sample from the Ab3d.PowerToys samples project.

If you want to get the 3D point that lies on a 3D plane (intersection of a 3D ray from the mouse position and 3D plane), see the "Cameras / Mouse 3D ray sample" sample in the Ab3d.PowerToys samples project.

Note that if you also use Ab3d.DXEngine, then see the hit-testing samples in the Ab3d.DXEngine samples project (there is a whole samples section for hit-testing).

If you want some other solution, please provide more information.
Andrej Benedik
#3
Thank you for this great answer. But, if I don't have a object to relate the hit testing?
I drag the mouse to the viewPort, on the screen, and if I won't hit an object created, I will not have a 3d position.
#4
I think, it will work to me if I will add a big Visual3DBox, with transparent color, and if I will hit the box, I will have the 3D Position.
#5
More info about my problem would be:
I have a sphere3d(for example), and I want to copy it on a point chosen by the mouse on the viewport. I don't want to go with mouse over an object(like a box), in order to detect the mouse position(3DPoint). 
Are there any options if I don't go over an object created to hit it, and to find the mouse position?
#6
As I said, if you do not have a 3D object the you can get a 3D point by intersecting a ray from a mouse with a 3D plane. You can define how the plane lies in the 3D space. See the"Cameras / Mouse 3D ray sample" sample in the Ab3d.PowerToys samples project for more info.
Andrej Benedik
  


Forum Jump:


Users browsing this thread:
1 Guest(s)