# Hide and center cursor but still move camera

**URL:** <https://discourse.processing.org/t/hide-and-center-cursor-but-still-move-camera/28016>\
**Category:** Coding Questions\
**Created:** [February 23, 2021, 9:48am UTC](https://discourse.processing.org/t/hide-and-center-cursor-but-still-move-camera/28016 "2021-02-23T09:48:45Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![yeppii](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/yeppii/32/12180_2.png) [@yeppii](https://discourse.processing.org/u/yeppii)\
**Post date:** [February 23, 2021, 9:48am UTC](https://discourse.processing.org/t/hide-and-center-cursor-but-still-move-camera/28016/1 "2021-02-23T09:48:45Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Post date:** [February 23, 2021, 1:38pm UTC](https://discourse.processing.org/t/hide-and-center-cursor-but-still-move-camera/28016/2 "2021-02-23T13:38:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![yeppii](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/yeppii/32/12180_2.png) [@yeppii](https://discourse.processing.org/u/yeppii)\
**Post date:** [February 23, 2021, 1:51pm UTC](https://discourse.processing.org/t/hide-and-center-cursor-but-still-move-camera/28016/3 "2021-02-23T13:51:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Post date:** [February 23, 2021, 2:00pm UTC](https://discourse.processing.org/t/hide-and-center-cursor-but-still-move-camera/28016/4 "2021-02-23T14:00:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![yeppii](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/yeppii/32/12180_2.png) [@yeppii](https://discourse.processing.org/u/yeppii)\
**Post date:** [February 23, 2021, 2:00pm UTC](https://discourse.processing.org/t/hide-and-center-cursor-but-still-move-camera/28016/5 "2021-02-23T14:00:55Z")

</div>

link to the library pls?

---

<div class="post-metadata">

**Author:** ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Post date:** [February 23, 2021, 2:06pm UTC](https://discourse.processing.org/t/hide-and-center-cursor-but-still-move-camera/28016/6 "2021-02-23T14:06:35Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![yeppii](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/yeppii/32/12180_2.png) [@yeppii](https://discourse.processing.org/u/yeppii)\
**Post date:** [February 23, 2021, 2:08pm UTC](https://discourse.processing.org/t/hide-and-center-cursor-but-still-move-camera/28016/7 "2021-02-23T14:08:30Z")

</div>

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

> [@CodeMasterX](#):
>
> use the difference from last forceful movement of mouse and the current mouse position to get the movement.

How do you do this btw?

---

<div class="post-metadata">

**Author:** ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Post date:** [February 23, 2021, 8:12pm UTC](https://discourse.processing.org/t/hide-and-center-cursor-but-still-move-camera/28016/8 "2021-02-23T20:12:12Z")

</div>

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

```auto
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 )](https://docs.oracle.com/javase/7/docs/api/java/awt/Robot.html) (robot library documentation)
- use noCursor to hide the cursor.
- only change x & y if mousePressed (move only if mousePressed)

---

<div class="post-metadata">

**Author:** ![yeppii](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/yeppii/32/12180_2.png) [@yeppii](https://discourse.processing.org/u/yeppii)\
**Post date:** [February 24, 2021, 6:39am UTC](https://discourse.processing.org/t/hide-and-center-cursor-but-still-move-camera/28016/9 "2021-02-24T06:39:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Post date:** [February 24, 2021, 2:26pm UTC](https://discourse.processing.org/t/hide-and-center-cursor-but-still-move-camera/28016/10 "2021-02-24T14:26:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![yeppii](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/yeppii/32/12180_2.png) [@yeppii](https://discourse.processing.org/u/yeppii)\
**Post date:** [February 24, 2021, 3:35pm UTC](https://discourse.processing.org/t/hide-and-center-cursor-but-still-move-camera/28016/11 "2021-02-24T15:35:57Z")

</div>

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