Hi Ulrich and others.
I managed to set up tank rotation according to terrain , but tank is
rotating wrong ( opposite ) to direction vector.
So it basically lift up front side while travelling forward.
..
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);
Code pasted here: http://cpp.enisoc.com/pastebin/7383
Thanks,
Gab-
>
> [EMAIL PROTECTED] wrote:
> > terrainNormal = heightTestResults.getWorldIntersectNormal();
> > angle = terrainNormal.y();
> > tankXform->setAttitude(osg::Quat(osg::DegreesToRadians(angle),
> > osg::Vec3(0,0,1) ) );
> >
> > Maybe someone spots an error ?
>
> It's unusual to use the y component of the normal as an angle...
> /ulrich
Broken Computers
An office technician got a call from a user. The user told the tech that her
computer was not working. She described the problem and the tech concluded
that the computer needed to be brought in and serviced. He told her to
"Unplug the power cord and bring it up here and I will fix it." About
fifteen minutes later she shows up at his door with the power cord in her
hand.
--
Email.it, the professional e-mail, gratis per te: http://www.email.it/f
Sponsor:
Refill srl il paradiso della tua stampante - cartucce e toner compatibili,
inchiostri e accessori per la ricarica, carta speciale. Tutto a prezzi
scontatissimi!
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=5187&d=20060725
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/