[quote="omdown"]
Chris 'Xenon' Hanson wrote:
> Tony Horrobin wrote:
> 
> > Hi Kris,
> > Is the target moving too?
> > Cheers,
> > 
> 
> 
> Not at the moment.  Currently I'm only worried about figuring out how to 
> orient in the right direction, I'll worry about tracking at a later time.  =)
> 
> 
> 
> Chris 'Xenon' Hanson wrote:
> > Thrall, Bryan wrote:
> > 
> > > There's osg::Matrix::makeLookAt()
> > > 
> > 
> > Wow. if only that were named something intuitive that I would have thought 
> > to look for.
> > Or Look At, as the case may be. ;)
> > 
> > Does that answer your question, Kris?
> > 
> > -- 
> > Chris 'Xenon' Hanson, omo sanza lettere                  Xenon 
> > AlphaPixel.com
> > PixelSense Landsat processing now available! 
> > http://www.alphapixel.com/demos/
> > "There is no Truth. There is only Perception. To Perceive is to Exist." - 
> > Xen
> > _______________________________________________
> > osg-users mailing list
> > 
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > 
> >  ------------------
> > Post generated by Mail2Forum
> 
> 
> 
> Sort of..  that definitely looks like it's going to be what I need, but I 
> can't seem to get it implemented properly.  I've tried it this way:
> 
> 
> Code:
> 
> osg::MatrixTransform* pMatTrans = dynamic_cast<osg::MatrixTransform*>(node);
> osg::Matrix m = pMatTrans->getMatrix();
> osg::Vec3d   v =  osg::Vec3d( m(3,0) , m(3,1) , m(3,2) ); // save the 
> location for the eye point
> 
> // if I understand right, the vectors in order are:  eye point, lookat point, 
> up vector, right?
> m.makeLookAt( v, osg::Vec3d(0.0, 0.0, 0.0), osg::Vec3d(0.0, 0.0, 1.0) );
> 
> pMatTrans->setMatrix( m );
> 
> 
> 
> 
> When I run the code with this lookat call, the model is translated across the 
> XY plane and doesn't remotely look toward 0,0,0...
> 
> Prior to lookat the getMatrix call the model's getmatrix result is:
> 
> Code:
> 
> 
> Stars between numbers for ease of reading...  someone really needs to make up 
> a matrix forum manipulator! =P
> ____________________________________
> 
> |     1.65951e-16   *   1     *  0    *  0 |
> |     -2.47158e-15    *  -3.85743e-31   *  1  *  0 |
> |     1    *   -1.65951e-16   *   -2.81642e-16   *   0 |
> |     -6366.2   *   3182.6       *   3193.6    *   1 |
> ____________________________________
> 
> 
> 
> 
> 
> After calling makeLookAt the matrix is:
> 
> Code:
> 
> ____________________________________
> 
> |     -0.447157   *   0.366172   *   -0.816069   *   0 |
> |     -0.894455   *   -0.183057   *   0.40797   *   0 |
> |     0   *   0.912364   *   0.40938   *   0 |
> |     -1.26565e-13   *   3.71925e-13   *   -7801.06   *   1 |
> ____________________________________
> 
> 
> 
> 
> 
> I assume I'm simply calling something wrong somewhere...  can someone point 
> me in the right direction?[/code]




Okay an update on this, I've tried it with a far more simple example and tried 
working through the equations in the source code by hand...  something isn't 
quite right somewhere and I'm not understanding what, but I come up with the 
same results by hand as I do using the makeLookAt...

I tried just using:
eye ( 0, 0, 100 )
center ( 0, 0, 0 )
up ( 0, -1, 0 )

The resulting matrix I get from this is:

Code:

-1     0        0     0
 0    -1        0     0
 0     0        1     0
 0     0   -100     0 




I've stepped through the calculations the source goes through and that's all 
coming out the same as I get when I do it by hand, I just don't understand 
where those are coming from.  Obviously the position vector is inverted (-100 
instead of +) and for whatever reason it's not pointing at the target 
location...  man.. so confused..  I wish I had paid better attention in linear. 
 Hahaha.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=16577#16577





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to