Search Unity

Input System in Visual Scripting

Discussion in 'Community Learning & Teaching' started by RimTobbins, Apr 14, 2022.

  1. RimTobbins

    RimTobbins

    Joined:
    Apr 9, 2022
    Posts:
    8
    Hi! I'm messing around with the new(ish) Input System in Visual Scripting (unity version 2021.3.0f1), but not quite sure how the "On Input System Event" nodes work or how to use them to properly move an object around in my scene.

    I'm trying to use the On Input System Event Button node to move a cube using WASD/Arrow Keys. How do I take the outputs from On Input System Event Button and use them to control the objects movement?

    I'm incredibly new to Unity, visual scripting, and coding in general so any help is greatly appreciated!

    inputActions.JPG VS.JPG
    Using Debug, I can confirm that the script recognizes me pressing WASD keys but I don't know how to take those outputs and translate them to object movement.

    Thanks in advance!
     
    Last edited: Apr 14, 2022
  2. Kreece

    Kreece

    Joined:
    Apr 5, 2022
    Posts:
    6
    For movement you need the "On input System Event Vector 2" That one is gonna let you take out the X and Y axis of your controller or keys A and D = (X) W and S = (Y) .
    For a platformer, you'll only need the X (left and right)
    For a topdown style game you'll need both and use them to create a new vector2.
    For 3d you'll want to create a new vector3 and connect your input X to the Vector3 X and your input Y to the Vector3 Z and leave the Y at 0
     
    wtalent89 and RimTobbins like this.