Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mouse doesn't center #91885

Closed
PixelQuaker opened this issue May 12, 2024 · 4 comments
Closed

Mouse doesn't center #91885

PixelQuaker opened this issue May 12, 2024 · 4 comments
Labels

Comments

@PixelQuaker
Copy link

PixelQuaker commented May 12, 2024

Tested versions

4.2.2 current steam version

System information

Windows 10 pro

Issue description

I have the same issue where the mouse is visible and isn't centered even after using

func ready():
	Input.mouse_mode = Input.MOUSE_MODE_CONFINED_HIDDEN

The mouse courser isn't hidden and is still on the window screen, I can move the position around but it stops when I hit the end of the window

Steps to reproduce

head is a 3d node that contains a camera 3d

@onready var head = $head
func ready():
	Input.mouse_mode = Input.MOUSE_MODE_CONFINED_HIDDEN


func _input(event):
	if event is InputEventMouseMotion:
		rotate_y(deg_to_rad(-event.relative.x * mouse_sens))
		head.rotate_x(deg_to_rad(-event.relative.y * mouse_sens))
		head.rotation.x = clamp(head.rotation.x, deg_to_rad(-89), deg_to_rad(89))

Minimal reproduction project (MRP)

Sorry the project is too big, but the nodes for the head can easily be remade

@kitbdev
Copy link
Contributor

kitbdev commented May 13, 2024

Try using Input.MOUSE_MODE_CAPTURED instead of confined, see here.

@PixelQuaker
Copy link
Author

I've used
MOUSE_MODE_CAPTURED
MOUSE_MODE_HIDDEN
MOUSE_MODE_CONFINED_HIDDEN
MOUSE_MODE_CONFINED
but the mouse will not center itself

@Calinou
Copy link
Member

Calinou commented May 15, 2024

Your _ready() method is missing an underscore, so Input.mouse_mode = ... is never being called. It works on my end if I add the underscore 🙂

See godotengine/godot-proposals#3564.

@PixelQuaker
Copy link
Author

that fixed it thank you so much :DDDD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants