How can I hide and lock my cursor position?

Hi everyone. I’m making a first person shooter to try and learn Armory 3D. I’m moving here from the Blender Game Engine. My first project will be a sequel to my first Blender Game Engine game called Undead Fields. I just have a problem with the cursor. It moves normally so I cannot turn my character much and I cannot figure out how to fix this. Can anyone help? I basically just need my cursor locked to the center and then hidden. (By the way I don’t know any Haxe yet or Krom so I’ll need some help if that’s all necessary.) Thank you! :slight_smile:

2 Likes

If you are using nodes, then you can use this


Show mouse-> Visibility of mouse, checking it will show mouse, unchecking it will hide mouse.
Mouse Lock-> Locking mouse to game window area, checking it will lock mouse to window area, unchecking it will unlock mouse.

4 Likes

thx mate very helpfull

In haxe you can lock and unlock the crusor with:

iron.system.Input.getMouse().lock();
iron.system.Input.getMouse().unlock();

2 Likes

if you use this, how do you quit the game if you can’t drag the game window aside to click ☐close?

tab out of the game… OTL

also: firing the gun the first time seems to eat the mouse cursor too
so maybe scripting the gun to fire an invisible, silent ball on startup would work too?

First thing I do when starting a project is create a node scene trait. Put in an ‘on keyboard’ node set to released and escape, and have that go into a ‘Shutdown’ node.