[osg-users] rotate a arrow to a point

2010-04-20 Thread Lv Qing
Hi,

I have create a arrow up to the sky ,its position is OSG::Vec3(x,y,z),its 
rotation is osg::quat quat1(osg::degreetoradians(90.0)*osg::Vec3(0,0,1)).


I just want to rotate  this arrow  ,make it point to another 
point(osg::Vec3(x1,y1,z1)).



Thank you!

Cheers,
Lv

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





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] rotate a arrow to a point

2010-04-20 Thread Trajce (Nick) Nikolov
it is easy

let say your point is  osg::Vec3(x,y,z) and by default your arrow is poining
up osg::Vec3(0,0,1), then

osg::Vec3 point(x,y,z)
osg::Node* arrowPointingUp = 

osg::Quat q;
osg::Vec3 a = point.
a.normalize();
q.makeRotate(osg::Vec3(0,0,1),a);

osg::MatrixTransform* mxt = new osg::MatrixTransform;
mxt-addChild(arrowPointingUp);
mxt-setMatrix(osg::Matrix::rotate(q));

-Nick


On Tue, Apr 20, 2010 at 4:06 PM, Lv Qing donlvq...@msn.com wrote:

 Hi,

 I have create a arrow up to the sky ,its position is OSG::Vec3(x,y,z),its
 rotation is osg::quat quat1(osg::degreetoradians(90.0)*osg::Vec3(0,0,1)).


 I just want to rotate this arrow ,make it point to another
 point(osg::Vec3(x1,y1,z1)).



 Thank you!

 Cheers,
 Lv

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





 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org