Popup Menu

Hello,

I Need some help for GUI task…
What I want to achieve is I want to have a popup menu whenever I see an object long enough.
But I want this menu to be separate from the GUI node as to select the menu I Need to look at it again.
I tried using Picture object but doesnt seem to work.
Then I tried using Spatial but apparently I cant find the right coordinate to place it at the Scene.
It has to be relative to my view (1st Person view), but when I attach Spatial it will be relative to root node…

Thanks in advance

as I am not entirely sure I got the question, I might be off, but here my idea:

Shoot a ray, find the first collision, get the spatials coordinates, attach your “bubble” or what ever to the rootNode and move it above the found spatial?

Yes this is exactly what I am trying to do.

The problem will be the rotation of the box (I want to display a button so I figure I should create a box).
This box will not always face to my direction.
As I am flying I might be above the Scene or could be just standing on the Scene.

Also I find it hard to determine the x and y coordinate as I could be everywhere (But I want the box to always appear near the centre of my view).

give it a CustomControl (box.addControl(myControl); )
and have it rotate towards you in the update loop. Not sure if it’s the best idea, but at least it should be working :smiley:

in case you don’t know how to do this:
use on the spatial the lookAt method, enter the cam position

While I’m not exactly sure what you mean by center of your view … sounds like attaching to the guiNode to me?

1 Like

Yes it would be easier if I could attached it to the guiNode, but if I do that, the box(button) will be moving along with me when I am moving.
After the button shows up I want it to stay there so I can select it with my crosshair.

then I think the method I explained earlier should do the trick?
Check if you hit the right spatial (+time) - if the conditions are met, you add the button to the scene, looking at the camera? so it stays there and you may select a menu item.
So the only thing left is when you look neither on menu nor spatial, to make it disappear. Done.

Or is there anything else I missed?

This actually great at last I have progress!
But it’s not exactly accurate, so I did this
[java]mlButton.lookAt(cam.getDirection(), new Vector3f(0, 1, 0));
[/java]
But it is not always face to camera.

I am pretty sure you need the cam position

This is exactly what I need!!
Thanks a lot =D

1 Like