Mouse coordinates all crazy? [Libgdx]

 I have a game where the player follows the mouse's x position and I want it to not go past the screen width or before it, but I'm getting some insane numbers in the x position of the mouse.

 This is what I have to get the mouse position in the player class: 

x = Gdx.input.getX() - playerTexture.getWidth()/2;

Also, the width of the screen is only 480

try just outputting the gdx.input.getx , see what it outputs. Most likely it’s an issue with texture , also remember a -b /2 is not the same as (a - b)/2 again another possible error.

Actually it is. (Maybe you meant (a - b) / 2?)

Bah yes , a trivial mistake :frowning:

even with only getting the input the mouse coordinates are crazy

Hard to help you when this is all the information you give. What’s wrong with the mouse coordinates; what is your code doing and what is the desired output? If you want the player to follow mouse position you’ll most likely have to unproject the mouse coordinates.