playMaker

Author Topic: Axis using Keyboard or controller  (Read 3194 times)

DennisJensen

  • Full Member
  • ***
  • Posts: 104
Axis using Keyboard or controller
« on: December 08, 2015, 07:36:39 AM »
Hi,

First, thank you for this awesome community.

I made this game called Square Clash this weekend in 38 hours.

Video:

It's working really well with a XBox controller, and I use  "Axis event" and "Get Axis Vector" to move my characters around. I then made some new inputs in my project with the keyboard, and then I changed it so that you could choose between keyboard or XBox controller.

The problem is that when I use keyboard and "Get Axis Vector" to define my movement, it doesn't work when I want to jump as well and are holding down two movement buttons. So basicly I works if I go in one direction like left, but if I move in a diagonal way it does NOT. I guess it's when I use three buttons to control the character instead of three?

Any suggestions are very welcome.
Game Designer, CEO, Artist
http://2ndStudio.com

DennisJensen

  • Full Member
  • ***
  • Posts: 104
Re: Axis using Keyboard or controller
« Reply #1 on: December 09, 2015, 07:21:29 AM »
Okay, so I'm still not getting it. I would like to use axis because then I can just replace the controls this way. That's why I'm using a string to define the buttons and Axis.



Any ideas are very welcome :)
Game Designer, CEO, Artist
http://2ndStudio.com

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Axis using Keyboard or controller
« Reply #2 on: December 09, 2015, 07:50:20 AM »
Hi,

 Axis are all defined in the Unity Input preferences, have you worked on this?

http://docs.unity3d.com/ScriptReference/Input.html

Bye,

 Jean

DennisJensen

  • Full Member
  • ***
  • Posts: 104
Re: Axis using Keyboard or controller
« Reply #3 on: December 09, 2015, 10:01:44 AM »
Hi,

 Axis are all defined in the Unity Input preferences, have you worked on this?

http://docs.unity3d.com/ScriptReference/Input.html

Bye,

 Jean

Hi Jean,

Yes the inputs are setup correctly, If I don't move and press Jump it works, if I move in one direction like UP and press Jump it works. But if I move in a diagonal it doesn't work. For example if I hold Left and down and want to jump, the jump doesn't work. The wierd thing is that in some diagonal directions it works.
Game Designer, CEO, Artist
http://2ndStudio.com

DennisJensen

  • Full Member
  • ***
  • Posts: 104
Re: Axis using Keyboard or controller
« Reply #4 on: December 10, 2015, 11:16:37 AM »
I found this so wierd,

I set up my vertical and horizontal Axis to Up, Down, Left and right arrow keys. It works to move around.

I set up my jump button to space. It also works. Unless I'm holding down Up and Left or Down and Left or Down and Right but it works when I'm holding down Up and Right.

I tried to do a new movement setup on a box in a new scene, same result.

It just doesn't register when I press it. Any ideas? I'm having a lot of trouble with this.
Game Designer, CEO, Artist
http://2ndStudio.com

DennisJensen

  • Full Member
  • ***
  • Posts: 104
Re: Axis using Keyboard or controller
« Reply #5 on: December 10, 2015, 11:24:28 AM »
SOLVED:

Okay this was weird. I was using the arrow keys and space to jump, left CTRL to push. Which didn't work. I now changed Jump to K and push to L and now it works. Dunno why :/
Game Designer, CEO, Artist
http://2ndStudio.com