Change direction of the arrow

Hey guys me again!







I want to change the direction of the arrow (green point)! You see its on the bottom-right corner, but i want it in the center of the view! oO I have no idea how to change the direction vector…



[java]this.setLinearVelocity(cam.getDirection().mult(200));[/java]



How do i change the vector? Help me xD



Thank you very much!



See ya, final

You can find the center of the screen in world space by using the method Camera.getWorldCoordinates(), to find the center of the screen, use the Camera.getWidth() and getHeight() methods.

And how do I find the direction of the arrow with the worldcoordinates?

See the HelloPicking test, it basically finds a ray for the middle of the screen. You can just use the ray’s parameters for your arrow.

This is interesting… As you see Dennis has overlayed his GUI over the full 3D viewport.

I wonder, is it possible to project the 3D viewport only in the non-GUI subsection of his screen?

My problem is that the center of the viewport isn’t the center of the gamescreen… I need to change the Vector to upperleft… simple math i think… but i have no idea how to do this xD

No it seems to me that you need to runthe 3D in the topleft corner (somehow), or you’ll run into other problems. Like, now you’re calculating the scene while half of it just isn’t visible. Waste of performance.

You could just limit the viewPort (the main viewport) to the area of the screen that is used for the 3D display.

The main problem of limit the 3D display is, that guiNode and rootNode have the same viewport. Means if I limit the viewport, the guiNode will not update… Do you have any ideas how to do that?