Hi,

What would be the best approach to solve the following problem where I need one 
node to be updated through a callback to face another node? I understand how to 
get a node to face the screen with a billboard but that's not the problem 
here... 

Here is the problem:

I've got a satellite node that is a child of a PAT and currently, I am updating 
that PAT position only to orbit the satellite around a planet node. I want to 
update the satellite PAT rotation also so that the satellite Z-Axis always 
faces the planet node origin. So, I need to compute the proper rotation Quat …


Code:

Quat GetRotation( const Vec3& tgtPos, const Vec3& subjectPos )
{
Quat ret = what?;
return Quat;
}

Vec3 targetPosition(...);
Vec3 satellitePosition(...);
Quat rotation = GetRotation( satellitePosition, targetPosition );

satellitePAT->setPosition( satellitePosition );
satellitePAT->setRotation( rotation );




What would be the best approach for the calculations in GetRotation(...)  using 
OSG functions? I can work out the math on my own but I'd like to know if there 
are any cool OSG utilities to do this.

Thank you!

Cheers,
Paul

------------------------
things are more like they are now than they have ever been before

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





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

Reply via email to