playMaker

Author Topic: Get Axis Vector float exceeding 1.0 (SOLVED)  (Read 2184 times)

mrbdrm

  • Playmaker Newbie
  • *
  • Posts: 39
Get Axis Vector float exceeding 1.0 (SOLVED)
« on: July 18, 2013, 10:19:06 PM »
Hello
I am using the Get Axis Vector to control my player and sending a float of the "Store Magnitude" variable to mecanim to play a blend tree based on the float range from 0.1 to 1
the problem is when i hit two keys (W and D) the float will be 1.4
how can i limit the float from going above 1?
its all fine when i press one key but when i press two simultaneity the float exceed the 1 limit.
« Last Edit: July 19, 2013, 08:19:47 PM by mrbdrm »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Get Axis Vector float exceeding 1.0
« Reply #1 on: July 19, 2013, 06:08:05 PM »
You can use the Float Clamp action.

Note, if you draw a diagram you'll see why magnitude exceeds 1. The horizontal and vertical axes make a square (not a circle as you might expect), so when you press 2 keys you move into a corner of the square, where the magnitude is 1.4.

Using Float Clamp you can constrain the output to be within a circle.

mrbdrm

  • Playmaker Newbie
  • *
  • Posts: 39
Re: Get Axis Vector float exceeding 1.0
« Reply #2 on: July 19, 2013, 08:19:14 PM »
Thanks Alex  :)