Im using Screen To World Point… To transfer mouse position and use these vector data to set location to a gameObject (target reticle)
So that when i move up the mouse, the reticle moves up. And as well as horizontal mouse moves will move reticle as well.
And then I’ll make this value to change X rotation of my player spine so it aims up and down.
Now, there’s little info online about how to get mouse axis using the new input package system … So here’s how i did it to get it:
=== How To Get Mouse Position With New Input System For Visual Script ====
Project settings > input package > add new action in player and name it “mouseAim” (or whatever suits you)
Copy the default Look > Mouse(delta) action and pasted it inside mousePosition and changed delta to position.
Then regenerate nodes in visual script settings.
============
Now i can get mouse axis.
And here’s the issue… Mouse vector axis doesnt match canvas image UI rectTransform position (pos Y and pos X)… So i was reading about making a translation between world and screen.
Using this node “ScreenToWorldPoint”
But when i use this in the graph editor and enter play mode… i can see when i move the mouse in Game, the mousePosition is getting axis data. But everything after this screen to world is giving me fixed numbers. They won’t move unless i move the character. And tiny numbers of movement.
Is it because im using CineMachine camera following the player? Is there other way of using this node and im using it wrong?
I am not an expert on Visual Scripting in Unity right now, but what jumps at me is that you only connected the data pin from the On Input System Event Vector 2 and not the white execution pin.
I suppose you wanted to SetVariable on that event so that you remember the new mouse position in your mousePosition variable and then use the value from that variable on each update. Not sure that is supposed to work if you try to do that with only this one Set Variable for mousePosition. I could imagine that you need a separate GetVariable or so (is that a thing?) for that, since it runs in a different execution sequence.