Hi Chris, I had already seen the demo and I searched on the forum and on the Community wiky, I'm probably wrong but I do not find what I need.
Yes, I use the AC mouse, and I just need to move the mouse from x, y to x1, y1. With KickStarter.playerInput.GetInvertedMouse () I read the cursor position but really I did not find how to change its coordinates.
When the player clicks on an item I need to move the mouse a few pixels in x and y, then immediately return the control of it to the player.
Do you think that studying the suggested demo should I be able to get this behavior?
If you're talking about moving the system cursor, it can't be done. If you're removing control from the player so that the effect is visual-only, you could try replacing the cursor's texture with one that is offset.
Sorry I was referring to the WorldSpaceCursorExample script.
I use Cursor rendering = Software and Replace Mouse Cursor in Main Cursor Setting.
I read that in a post you reply
You can use the keyboard to control the cursor if you set your Input Method (in the Settings Manager) to Keyboard Or Controller
and in another post a user suggests
If you wanted the WASD to move the pointer you would need to create the actions and assign them the proper inputs in the rewired manager.
I see that I can change through script the Input Method from Mouse and Keyboard to Keyboard Or Controller.
Would not it be possible to simulate in-game pressing the keys to move the cursor?
I wanted to try this but I have a issue. Changing the Keyboard and Controller and defining two new CursorHorizontal and CursorVertical inputs, should the cursor move by pressing assigned keys? This does not happen also with the Lock Cursor option disabled.
No, that should work. What version of Unity are you using, and are you using any input-overriding scripts in the scene (including the example)?
When using Keyboard And Controller input, the cursor is not tied to the mouse but is instead simulated. If you rename Unity's default "Mouse X" and "Mouse Y" to "CursorHorizontal" / "CursorVertical" then that should also allow mouse-control (though it won't be scaled / positioned correctly).
Once the inputs are working, you can also override those using InputGetAxisDelegate.
I have discarded the idea of moving the cursor by simulating the pressure of the keys, it does not seem very reliable.
But the need remains. The offset of a new texture as you suggest would not work because I have to work with Inventory Items and the hotspot would be out of focus.
I've tried several workarounds but none of them satisfy me.
If I can not do this through scripts, even if I prefer not to use other plugins, I see that some plugins are available on the Asset Store that allow me to move the system cursor.
Should there be no problem using them with AC?
They refer to the hardware cursor, I think they should work even if I use the AC software cursor since it is simply attached to the system cursor?
Not knowing the assets, I can't answer for sure. But if all they do is move the system cursor, and you use "Mouse And Keyboard" AC input, then you should be OK. It's possible to temporarily disable AC's cursor system using Engine: Manage systems Action too, if necessary.
Comments
Details on using degelates to remap inputs, as well as an example that uses the above, can be found in the Manual - "Remapping inputs".
If you're talking about moving the system cursor, it can't be done. If you're removing control from the player so that the effect is visual-only, you could try replacing the cursor's texture with one that is offset.
When using Keyboard And Controller input, the cursor is not tied to the mouse but is instead simulated. If you rename Unity's default "Mouse X" and "Mouse Y" to "CursorHorizontal" / "CursorVertical" then that should also allow mouse-control (though it won't be scaled / positioned correctly).
Once the inputs are working, you can also override those using InputGetAxisDelegate.