SOLVED: How can i use both boolean "value" and "keyPressed"

ween trying to solve this for awhile now.

basically i have

if (binding.equals(“Left”))
{
left = value;
}

I am trying to add

else if (binding.equals(“MouseRotate”) && keyPressed) {
rotate = true;
inputManager.setCursorVisible(false);
}

but i can’t seem to work it out.

If MouseRotate is really mouse rotation then I’m not sure it will have a keyPressed.

Otherwise, we don’t have enough information to help. The typical way to debug such a thing is to put some System.out.println()s in the method to verify you are getting the values that you think you are getting.

@pspeed said: If MouseRotate is really mouse rotation then I'm not sure it will have a keyPressed.

Otherwise, we don’t have enough information to help. The typical way to debug such a thing is to put some System.out.println()s in the method to verify you are getting the values that you think you are getting.

sorry.

I am trying to make the camera rotate only while the left mouse button is held down.

in the main class i have defined a private boolean rotate = false;

and i am trying to get
[java]else if (binding.equals(“MouseRotate”) && keyPressed) {
rotate = true;
inputManager.setCursorVisible(false);
}
else if (binding.equals(“MouseRotate”) && keyPressed == false) {
rotate = false;
inputManager.setCursorVisible(true);
}[/java]
to change rotate to true when the mouse button is pressed to allow the mouse to hide the cursor and rotate the camera.

so far everything else works. i can manually start rotate as true, and everything works fine (except the cursor is always gone and the camera follows the mouse all the time as it believes it is pressed)

so the main issue i have is solving how to make it notice the mouse button and do the above code.

I’m also now sure how to add the keyPressed boolean to the public void, as it seems to error when trying to add more than one boolean to the following code.
[java]
public void onAction(String binding, boolean value, float tpf) {
if (binding.equals(“Left”))
{
left = value;
} [/java]

I guess you need to set a boolean when the mouse button is pressed and clear it when it is released. And that is the boolean you should be checking if you want to know if the mouse is dragging.

finally solved it. changed keyPressed into value and fixed up a couple of other lines. thanks for the help.