[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

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