Let me move a shape within the virtual world in a way to ensure that it eventually ends up in which the mouse pointer is around the canvas.
Things i have: -mouse position (x,y) on the Canvas3D object -Point3d object of in which a pick ray beginning in the Canvas3D viewport intersects using the first scene object. (reason for three dimensional space of where i wish to start the drag)
Things i want: -A way to translate the Point3d's coordinates to ensure that the first reason for intersection (the Point3d object) is definitely overlapping the a button position around the canvas (just like after i used the pick ray to determine which the consumer clicked on on in the Canvas3D object).
It may sound as if you wish to make use of the plane that is parallel towards the background plane and consists of the intersection point using the object. This can be used plane even if a button moves past the actual background as it is only a mathematical concept which stretches to infinity.
I am not really a Java programmer and so i can't provide you with code but I'm a math wizzard so here's equation you'll need )
Let P denote the initial intersection point and call the backdrop plane unit normal n. This normal can also be the standard in our plane of great interest. Let R denote a place around the ray and l denote it's unit direction vector.
Then your equation from the plane is (x-P).n = for any point x within the plane (the . denotes us dot product of two vectors). The equation of the point around the ray is x = R + t*l where t is any real number. The ray therefore intersects the plane when
(t*l + R - P).n =
t = (P - R).n / ( l.n )
This provides a t value to plug back to your ray equation to own intersection point.