Search Unity

Discussion Target the ground using new InputSystem/PlayerInput

Discussion in 'Input System' started by halfblue3, Sep 10, 2022.

  1. halfblue3

    halfblue3

    Joined:
    Mar 5, 2019
    Posts:
    11
    Basically what I'm trying to do is spawn something in front of a perspective camera that is attached to a world space canvas and would move using mouse.

    I have used InputSystem before for my character's movement. I know I need to create some methods that I need to link to an action to use InputSystem. But when I was researching about how to use mouse with InputSystem, it seems to be done in a different way. You can directly access the InputSystem mouse anywhere not just inside a method which I'm accustomed to with when I implemented character movement, which I saw on this informative yt video and some articles. I could use direction keys and such to move the targetting thing, but I think mouse is more appropriate for this scenario as you can move a mouse quicker and maybe more precise than WASD or direction buttons, etc.. So I want to know if this "free-range" (lol) mouse is the way to go or there is still that method that I need to use or there are other ways to do what I wanted to do.
     
    Last edited: Sep 10, 2022
  2. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,261
    If you don't plan on having controller support go with Mouse.current.position.ReadValue. If you do plan on controller support I would setup a value action with vector 2 as the control type and go from there.
     
  3. halfblue3

    halfblue3

    Joined:
    Mar 5, 2019
    Posts:
    11
    Thanks for the info