Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Using individual keys to move?

Discussion in 'Visual Scripting' started by Traumkampfer, Jul 12, 2022.

  1. Traumkampfer

    Traumkampfer

    Joined:
    Jul 7, 2022
    Posts:
    1
    I'm new to Unity and have been looking at several tutorials and guides, but they all seem to use GetAxis instead of GetKey to handle movement in games, so I'm lost.

    Im trying to set it up so that W moves forward, Left/right rotate, and back moves you back in a very slow manner (tank controls), but the biggest problem for me seems to be that the GetKey input is a purple dot and wont connect to Transform nodes (blue dot)

    Also mildly related but Im finding that if I set up GetAxis to a rotate node, and then make another GetAxis connected to its own rotate node, only one will ever function because connecting it to Update disconnects the other one, what do I do to make them both work?

    If I just connect things via the green line then the GetKey will be stuck as always true forever for some reason.

    Terribly sorry for what Im sure is a basic question but Ive been trying hard to figure it out and failing.
     
  2. toomasio

    toomasio

    Joined:
    Nov 19, 2013
    Posts:
    199
    GetKey is not usually recommended as it does not have any modular value....unless you need to do something keyboard-binding specific.

    If you still wish to use GetKey, you will need to use a series of Branch/If nodes on update, followed by translating or adding force in a specific direction to your controller....or rotating the controller.

    more info here: