playMaker

Author Topic: Keyboard Input, Bad Diagonals [SOLVED]  (Read 3892 times)

FractalCore

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 100
Keyboard Input, Bad Diagonals [SOLVED]
« on: October 26, 2013, 01:36:41 AM »
The Get Axis Vector action is great for all kinds of input control but it unfortunately doesn't take into account the problem of diagonals.

Hold down forward key = speed 1.0
Hold down forward and left keys = speed 1.414

I've come up with overly complex ways to compensate and scale the speed down when a diagonal direction is input. But it's always messy and doesn't work perfectly.

I realize the issue doesn't occur if a controller analog stick is used. There needs to be a solution to use the Horizontal and Vertical inputs from both controller and keyboard at the same time, without this diagonal problem occurring.
« Last Edit: November 18, 2013, 11:40:11 PM by FractalCore »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Keyboard Input, Bad Diagonals
« Reply #1 on: October 26, 2013, 02:06:00 AM »
Hi,

 Simply clamp the input speed to 1 and that's it. Then you multiply and work with it to become a speed. Use "float clamp" for this.

I can't find it but there was a similar post a while back and I provide a solution if I recall right, I'll see if I can find it, have a look as well if you can.

bye,

 Jean

FractalCore

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 100
Re: Keyboard Input, Bad Diagonals
« Reply #2 on: October 26, 2013, 02:54:50 AM »
Holy crap, Vector 3 Clamp Magnitude!

Just stick that under the Get Axis Vector, set to 1... It's like it was made specifically for this purpose.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Keyboard Input, Bad Diagonals
« Reply #3 on: October 26, 2013, 04:50:21 AM »
Hi,

 Even better yes! well spotted.

bye,

 Jean

zatoichi

  • Playmaker Newbie
  • *
  • Posts: 1
Re: Keyboard Input, Bad Diagonals [SOLVED]
« Reply #4 on: March 10, 2014, 07:00:17 PM »
I seem to not getting it to work.
I followed the video tutorial on how to setup the third person controller and everything seems to run perfectly except the speed of 1.414.. when using more then one movement key.

As mentioned above, I tried to add the "Vector3 Clamp Magnitude" Action below the "Get Axis Vector". The stored vector from there is the variable for the clamp, and Max Length is set to 1.
What did I miss?

Do you need more info to be able to help?
Thanks in advance!


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Keyboard Input, Bad Diagonals [SOLVED]
« Reply #5 on: March 11, 2014, 07:12:04 AM »
Hi,

 your clamp action either do not look at the right vector data or do not store its valu in the right fsmFloat variable. Double check these and if it's still not working, sned some screenshots of your state and actions setup.

bye,

 Jean