Getting a GUI marker on something in 3D space?

I want a Nav-marker like thing, and I’m unsure of how to get this effect. I know how to put a picture on the guiNode, just now how to place it correctly. Other examples for an effect like this are grenade indicators, username indicators, etc. Has anyone done this? If so, how did you do it? If not, does anyone have an idea how? Thanks in advance!

I guess you would do the opposite of: “clicking on the guiNode (screen) and translating that to a position in 3D space based on a CollisionResult” which there is plenty of info on. I’ve never tried doing this though.



If you find a nice way to do this, perhaps it can be made into a tutorial

That was my thought, but there’s gotta be a more simple way. I figured there’d be a method in the Camera class that was something like “isSpatialOnCam(Spatial spatial)” but I guess not. Maybe adding a “getSpatialLocationInGUIUnits(Spatial spatial)” method to the Camera class would be helpful. (That’s your queue, developers! :wink: ) Other than that, I’m sort of at a loss.



About the tutorial, I’d definitely be willing to make one.

@vinexgames said:
Maybe adding a "getSpatialLocationInGUIUnits(Spatial spatial)" method to the Camera class would be helpful. (That's your queue, developers! ;) )


You mean, like this?
http://hub.jmonkeyengine.org/javadoc/com/jme3/renderer/Camera.html#getScreenCoordinates(com.jme3.math.Vector3f)

Well there goes my credibility. xD That’s exactly what I’m looking for. So I’m assuming that the following is true:



0 < Vector3f.x < getWidth() and 0 < Vector3f.y < getHeight() then the Vector returned is on the screen, and anything else is off. I could do a method where if it’s less than 0, keep the marker on the side of the screen or something. I’ll figure it out, but that’s exactly what I was looking for. Thanks a lot!

@vinexgames said:
Well there goes my credibility. xD


and mine :)