edited August 2015 in Makinom Support
trying to create a character controller. Walking forward and backwards works fine. How do I set it up for diagonal input?
I have diagonal movement animationsI would like to use.

Thanks
Post edited by Loopdaloop on
  • Well, depends on how you've implemented your movement - there are many ways to do that.
    E.g. the Move node itself already allows moving in all directions/diagonally.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • I've placed forwards on w, backwards on s, left on a and right on d. I want it so that when I press w+d I will move diagonal in the direction in correspondence to the input and vice versa for the other diagonal combinations. Input node doesn't allow for combinations of buttons at the same time, from what I can see it's a one button deal.
  • Input node just checks input - if you want to check multiple keys, use multiple input nodes in sequence, or use an input key with the Input Origin set to Input Key and use the keys that should trigger it.

    What you should actually do is use W and S as a vertical axis (i.e. input key with W as positive key and S as negative key) and A and D as a horizontal axis (i.e. input key with D as positive key and A as negative key).
    With using the keys as axis, you can use them in a Move node for the movement vector of your game object (using vertical for the Z-axis and horizontal for the X-axis). Or you can use the input keys to store the movement vector into a variable and manipulate it further to your liking and use that in one of the movement nodes.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Ok, thanks. For some reaosn I thought you needed to have an input node before the 'move' node. Object now moves in all directions. :)
    Another question, I imagine there's a node or a setting in a node where I can detect if vertical. is being pressed down/up and ditto for Horizontal, so different aniumations can be played for each direction. I checked the pre-made game tutorials and couldn't see a mention of it (possible I simply missed the section). Which node would I need to make each direction be able to function for different animation/what else may be needed?
  • In that case you'd need to check the input keys using multiple Input Key nodes in sequence and play the animation (or set mecanim parameters) you need.

    E.g. checking the horizontal axis, you'd have 2 checks in the Input Key node:
    - horizontal axis is greater equal 0.1 (or whatever value you want to check for, using 0 can lead to problems when using joysticks)
    - horizontal axis is less equal -0.1
    The first check would be up, the 2nd check would be down, the failed check (no input) would mean that the horizontal axis isn't used.
    After that check, you'd check the vertical axis with the same checks (where 0.1 would be right and -0.1 would be left). I.e. if you have the sequence up-right, you'd need to play that animation.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.