**  I'm not a 3D programmer, and if I use the wrong technical terms - sue me.  
It's how this bear of very little brain wraps his mind around a bunch of new - 
and therefore strange - concepts.
   
  Alberto:  Yes it does help - quite a bit.  Because what you say is what I 
want to do: rotate the tank so it's normal is parallel with the terrain normal. 
 And the code presented by the original author: 
   
  terrainHeight = heightTestResults.getWorldIntersectPoint(); 
terrainNormal = heightTestResults.getWorldIntersectNormal(); 
tankXform->setPosition(osg::Vec3(tankPosition.x(), 
tankPosition.y(),terrainHeight.z())); 
osg::Quat rotate; 
rotate.makeRotate(terrainNormal, osg::Vec3f(0,0,1)); 
tankXform->setAttitude(rotate); 
   
  doesn't do that.  I couldn't get it to work for me.
   
  rotate.makeRotate(terrainNormal, osg::Vec3f(0,0,1)); - gives the solution to 
"What rotation need I apply to the terrain normal to make it parrallel to 
vertical?"  Vertical being the implied normal of the tank-model.
   
  rotate.makeRotate(osg::Vec3f(0,0,1), terrainNormal); - is the line that gives 
the solution to "What rotation need I apply to the vertical to make it parallel 
to the terrain normal."  The two vectors need to be reversed from the original 
code.

To all the other newbies:  I hear the snorts of derision in the background.  
"It's only a detail."  "Rookie."  "Newbie."  "Everyone knows that."  Just 
ignore them, and keep plugging away.  If "they" are so smart then why didn't 
anyone else point out the disconnect between conception and execution?
   
  Oh I get it now, "they" intentionally leave those kinds of tiny problems 
lying around.  What else can the newbies tackle with any hope of success to 
boost their self-confidence?  Very clever.
     
  > El Lunes, 15 de Enero de 2007 23:59, Steve Schneider escribió:
> > >osg::Quat rotate;
> > >rotate.makeRotate(terrainNormal, osg::Vec3f(0,0,1));


> void  makeRotate (const Vec3d &vec1, const Vec3d &vec2)
> "Make a rotation Quat which will rotate vec1 to vec2. "

> In other words: you create a quaternion with the value of the angle between 
> the vertical axis (Z) and the terrain normal, which is in fact the sloping 
> angle of the tank (the amount of degrees the Z vector of the tank must 
> be rotated to match the terrain normal).

> HTH,

> Alberto



 
---------------------------------
Food fight? Enjoy some healthy debate
in the Yahoo! Answers Food & Drink Q&A.
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to