I saw this post and wanted to do something similar. This is my first time using JME and doing any real 3D development, so excuse the code crudeness. I am sure there are some better ways to implement this, but this works as something really basic. It allows you to navigate similar to an RTS, edge of the screen moves in that direction, the mouse wheel zooms in and out.
I just implemented a MouseInputAction and added it to a regular InputHandler:
public class RTSMouseLook extends MouseInputAction {
private Camera camera;
private Vector3f upVector;
private Vector2f bottomLeftCorner;
private Vector2f topRightCorner;
public RTSMouseLook(Mouse mouse, Camera camera, float speed,
Vector2f bottomLeftCorner, Vector2f topRightCorner) {
this(mouse, camera, speed, bottomLeftCorner, topRightCorner, null);
}
P.S.: How do I get the 2D Vectors for bottomLeftCorner and topRightCorner? Are those the Coordinates in 3D Space or the absolute Coordinate of the display?
If you want to move selected objects to a location selected by a mousepick, have a look at this thread.
http://www.jmonkeyengine.com/forum/index.php?topic=11911.msg88899#msg88899
Got the same problem recently
Thx for that, I just got the object selection and object highlighting on the terrain working, so now I need that info.
P.S.: How do I get the 2D Vectors for bottomLeftCorner and topRightCorner? Are those the Coordinates in 3D Space or the absolute Coordinate of the display?
Those params are to set the 2D absolute screen coordinates that determine when camera is moved. Usually this is just the screen resolution extents (i.e. for a screen resolution of 1024x768: bottomLeftCorner=(0,0) topRightCorner=(1023,767)).
Those params are to set the 2D absolute screen coordinates that determine when camera is moved. Usually this is just the screen resolution extents (i.e. for a screen resolution of 1024x768: bottomLeftCorner=(0,0) topRightCorner=(1023,767)).
Thanks for that. I was thinking a bit too complex at this time.^^