Hide and center cursor but still move camera

I want to hide the cursor and position it to the center of the window. I tried using the robot class to move cursor to the center of screen and it worked but the problem is I also need to be able to rotate the QueasyCam camera. How could I do this?
(Sorry I’m not good at explaining things and asking questions)

To hide the cursor use noCursor. For other things, I don’t know

1 Like

I know how to hide and center cursor but I need to center the cursor and allow queasycam to rotate at the same time

well one way, which works only in fullScreen mode, you need to use libraries.

Use roboto (mouse / keyboard controlling library) and use the difference from last forceful movement of mouse and the current mouse position to get the movement.

1 Like

link to the library pls?

It is a default java libary. Just use
import java.awt.Robot;

for documentation you can check the java libary (google java robot library)

1 Like

wait you said roboto not robot. anyways i’ll try that.

How do you do this btw?

here is a prototype. Try to improve it if you can.

import java.awt.Robot;
float x = 800, y = 450, px = 0, py = 0;
void setup() {
  fullScreen();
}
void draw() {
  background(0);
  circle(x,y,20);
  x = constrain(x,0,width);
  y = constrain(y,0,height);
  try {
    Robot rob = new Robot();
    x += mouseX-px;
    y += mouseY-py;
    rob.mouseMove(800,450);
    px = 800;
    py = 450;
  } catch(Exception e) { exit(); }
}

Help:

  • do not use pmouseX (doesn’t work correctly)
  • robot functions have to be in a try{}catch(Exception e){} to work.
  • Robot (Java Platform SE 7 ) (robot library documentation)
  • use noCursor to hide the cursor.
  • only change x & y if mousePressed (move only if mousePressed)
1 Like

I am using 3D mode and I am using QueasyCam library. Will It work there? I guess queasy cam already does stuff like this.

1 Like

That was the code I wrote, I have no idea about P3D nor about QueasyCam. Good luck

1 Like

I explored the code for queasycam and found out queasycam does same stuff.

1 Like