+1 vote

Hello, I am trying to make it so that the mouse is always on the player characters position with the command

Input.WarpMousePosition(this.Position) within the _Process method of the player's script.

it is then released on the press of a key.

This works except when using the 2D camera node which causes the mouse to be offset based on where the player is and the size of the screen.

I fixed this issue when making an object follow my mouse by using the GetGlobalMousePosition(); however, I can't find a global option for WarpMousePosition. Is there one? Or another way to accomplish what I'm looking for?

Godot version Godot Version 3.3.4 Stable Mono
in Engine by (13 points)
edited by

How's your code set up? Is this camera a child of player or a node independent of the player?

The code is

if (Input.IsActionPressed("rangedwish"))


void ranged_wish()
fieldOfWish.GlobalPosition = GetGlobalMousePosition();
fieldOfWish.Scale = (new Vector2(0.1f, 0.1f));

The camera node is independent of the player and child to the main scene.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.