JMEDesktop rotation problem

Hello all!

I'm having trouble with the JMEDesktop not showing in certain camera angles. How am I supposed to rotate the desktopnode when setting it up with a free look camera? I've tried it like this:


desktopNode.lookAt(cam.getLocation(), cam.getUp());

but then the desktop doesn't show in any camera angle. If i do it like in the TestJMEDesktop:

desktopNode.getLocalRotation().set( 0, 0, 0, 1 );

desktopNode.getLocalTranslation().set( display.getWidth() / 2, display.getHeight() / 2, 0 );

It shows up but not in all angles.


Rik said:

desktopNode.lookAt(cam.getLocation(), cam.getUp());

Does not make any sense to me. What do you want to achieve? The second code snipet you posted is for ortho mode and you should turn off culling for the desktop in ortho mode (e.g. put the desktop into the fpsNode). Rotating the Desktop itself makes sense in non-ortho (normal perspective) mode only.
Do you mean cam.lookAt(desktopNode.getLocalTranslation(), cam.getUp())? That's different to the line above!
As you already posted about this in another thread and said you had problems with understanding Quaternions and rotation, maybe you want to read up on 3D-rotation and Quats in the wiki and the rest of the web? :|
put the desktop into the fpsNode

Thanks alot. Now it works perfectly!
It's no excuse but in TestJMEDesktop the desktop is placed in the rootNode.

What I was trying to do with the two first code-lines was place the desktop just in front of the camera and then have it look at the camera so it was correctly rotated. I later succeded with this after learning a bit more about rotating. I had to have the desktop in perspective mode. It worked but it didn't look very good and potentially the desktop could end up behind objects in the scene if standing too close to something.

I should probably read up on whats going on with the fpsNode as well.

Thanks again!