Hi Stephane,

Stephane Routelous wrote:
> ok, i found a way :
> 
> void display(void)
> {     
>   ViewportPtr vp = mgr->getWindow()->getPort(0);
>   int mx = vp->getPixelWidth()/2.0;
>   int my = vp->getPixelHeight()/2.0;
>   Line line = mgr->calcViewRay(mx,my);
>   Vec3f ld = line.getDirection();
>   ld*= -1;
>   Quaternion qD(Vec3f(0,0,1),ld);
> 
>   Vec3f up_temp;
>   qD.multVec(Vec3f(0,1,0), up_temp);
> 
>   Quaternion qU(up_temp, mgr->getNavigator()->getUp());
> 
>   Quaternion qResult;
>   qResult = qU;
>   qResult.mult(qD);
> 
>   Matrix m;
> 
>   m.setRotate(qResult);
> 
>   beginEditCP(theTextTrsf);
>   theTextTrsf->setMatrix(m);
>   endEditCP(theTextTrsf);
> 
>   mgr->redraw();
> }
> 
> 
> and it seems to work.
> 
> any comment ?

You can use a Billboard node, which will rotate to face the viewer 
automatically. Billboard is a Group, so you can put whatever geometry you want 
under it.

Hope it helps

        Dirk

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to