Where in SimpleGame is the move camera method?

I would need to know what method is called to make my camera move when I move my mouse.

because Im adding gui, and I want the camera to change angle when I hold right mousebutton and drag, not just drag.

Anyone know where this hidden method is hiding?

Cause I cant find it myself :frowning:

in the cam field is the Camera object

Also there is a MouseLook handler, look in the superclasses

ahh thanks :slight_smile:

I got it all fixed, except I cant get the mouse obj…

I'v tried input.DEVICE_MOUSE

but it return string instead of the mouse obj…

and since mouse extends quad I'v tried getting it from there, but it didnt work :frowning:

How do I get the mouse obj?

Nvm, I found out u could do this:

new RelativeMouse("Mouse Input")

to get the mouse

But it doesnt work :expressionless:

Heres how I do it:

MouseLook mouseAction = new MouseLook(new RelativeMouse("Mouse Input"), cam,1f);
        //mouseAction.setSpeed(0f);
        mouseAction.setButtonPressRequired(true);
        input.addAction(mouseAction);


still it doesnt change the mouse behaivor-.-

The question is what you want to do with the mouse?



simples thing would be to use function like this:



              MouseInput.get().isButtonDown(0/1/2);
              MouseInput.get().getWheelDelta();
              MouseInput.get().getXDelta();
              MouseInput.get().getXAbsolute();



There are although more "highlevel"-function with InputHandler and actions. But I never used them (yet)

PS: Argh...addez! The downtime of the server really shrinked your account's average posts per day (only 4 left...and it is decreasing) :D

Hehehe XD

I know I post many posts a day, but I work alot on my java project when I get the chanse too,

and yea, I gotta catch up XD



So to the subject:

MouseInput.get().isButtonDown(0); doesnt change much…

What I want with buttondown thing on mouse is that you must be pressing right on the mouse, while draging or the camera wont rotate…

And setButtonPressRequired(true); seems to do it for me, but I think Im not applying it correctly  :?

Okej, after loads of research and debugging.

I found out 2 things:

  1. There is no working example on how to use picking with the mouse
  2. I made one simple XD



    Here it is for all of you who might need it later:


private void updateMouse() {
      boolean state = MouseInput.get().isButtonDown(0);
        if (state == true){
           mousePick(rootNode);
        }
       
   }




   private static void mousePick(Node rootNode) {
       //Get the mouse position
       Vector2f mousePosition = new Vector2f(MouseInput.get().getXAbsolute(), MouseInput.get().getYAbsolute());
       //Create a pick ray from the display
       Ray ray = DisplaySystem.getDisplaySystem().getPickRay(mousePosition, false, new Ray());
       //Find the results (Use which ever method suits your needs
       PickResults results = new TrianglePickResults();
       //PickResults results = new BoundingPickResults();
       //We normally want the distance to see which object is closest
       results.setCheckDistance(true);
       //Get the results from a node
       rootNode.findPick(ray, results);
       //Loop the results
       for (int i = 0; i < results.getNumber(); i++) {
           PickData hit = results.getPickData(i);
           System.out.println("Hit: " + hit.getTargetMesh().getParent().getName() + "(" + hit.getDistance() + ")");
       }
   }


Put updateMouse() in the SimpleUpdate loop and your done :)

It now reacts to left mouse clicks.
set MouseInput.get().isButtonDown(1); to make right mouse clicks :D Enjoy!