Hi Andreas,
On Tue, 2004-06-22 at 03:51, Andreas Kopecki wrote:
> Hi Dirk!
>
> On Sat, 2004-06-19 at 11:51, Dirk Reiners wrote:
> > > I would like to map the location of my 2d mouse pointer to 3d
> > > coordinates within the scene. As there seems to be no posiblity to get
> > > the view plane out of the viewport, I tried the following:
>
> [snip]
>
> > If you have the view distance, you can just get the point using the ray
> > you got above, but the view distance needs to be defined externally. The
> > Trackball Navigator for example just intersects the ray with the scene
> > to find the distance needed and uses that.
> >
> > But the specifics depend on what you really want to do, maybe you can
> > give us some more details.
>
> I just want to get the "hand"-coordinates (in this case the location of
> the mouse pointer). One application is to create an object that floats
> just below the mouse pointer, but I want to keep it as general as
> possible, so I don't want to use a foreground.
The problem is that it's an under-specified problem. A 2D mouse position
corresponds to a line in 3D (i.e. there are infinitely many 3D positions
for each 2D position). You have to limit that final degree of freedom
for something that makes sense, like keep a fixed distance from the
viewer, or the view plane.
The already mentioned helper function gives you the line for a 2D
position, and then you have to decide where in 3-space the object needs
to be. That's what the Trackball viewer does when you middle-click. It
keeps the objects under the mouse and at a constant distance.
Hope it helps
Dirk
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users