Ulrich Hertlein wrote: > Hi Kris, > > On 21/08/09 8:00 PM, Kris Dale wrote: > > > If osg::Matrix::makeLookAt doesn't work... it looks like I'm back to my > > original > > question of trying to figure out what the equations are to finding the > > correct vectors > > for x and z when I've already set the y vector to point at the the target > > position. > > > > makeLookAt should still be fine but it is pretty much geared for use with a > view matrix. > The OpenGL camera looks down the negative Z-axis and gluLookAt and > osg::Matrix::makeLookAt > produce matrices for that. > > Why don't you try 'makeRotate(Vec3& from, Vec3& to)'? 'from' whould be your > rockets > forward vector and 'to' would be the normalized ('target' - 'pos') vector. > > You could combine that matrix with a translation to 'pos' or use 'getRotate' > to obtain a > quaternion to put into a PositionAttitudeTransform. > > Should work. (Famous last words, I know ;-) > Cheers, > /ulrich > _______________________________________________ > osg-users mailing list > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > ------------------ > Post generated by Mail2Forum
Bahahahaha. Brilliant! The makeRotate(from, to) works like a champ! From here I think it's just a matter of figuring out how to animate the effect (slow turning toward the target location...) This is great though! I'm definitely going to have to dive into the source and see how it goes about coming up with this orientation because after spending a few days on this my brain is absolutely about to catch FIRE about it. hahaha. ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=16589#16589 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org