- Home /
Change pointer position using controller or mouse
So what I want to do is: move cursor/pointer using a gamepad controller or mouse, only when I'm in the menu. I have no idea how to do anything similar to this and I did not find any tutorial explaining this. I would prefer getting an overall explanation about how to do this (and if you can also tell me which are the most sophisticated functions which came with the new input system and I should know about, I will highly appreciate that). Is it easier to move the cursor using both inputs at the same time (gamepad and mouse) and move it at every input detection ? Should I try to detect what is the player using when the game starts and let him use only that to move cursor? Any idea about how to design this and how to apply it helps! Thank you very much!
What I know so far: -I can control the mouse position using: Mouse.WarpCursorPosition(Vector2)
have no idea how to get the current position of the mouse because Pointer.position returns some weird data structure (Vector2Control) that can't be changed into Vector2. I understand the mouse coordinates are in pixels, but at least give me pixel coordinates not that weird Vector2Control. Another idea that I tried but I would rather not stick with that is moving the cursor in the middle of the screen and simulating it's position and moving it to there, every frame (I have a vector2 which initially holds middle of screen and then updates that position every frame, if I give a certain input, ex: move left joystick). If this is a good practice (even if I don't think it is), again, please let me know! Thank you !
Your answer
Follow this Question
Related Questions
Detect which local player clicked a button 0 Answers
PlayerInput - SendMessages not working after changing the scene 1 Answer
MultiplayerEventSystem Same UI BUG 0 Answers
Second Player Cannot Navigate the Menu 2 Answers
File Input 1 Answer