playMaker

Author Topic: Diagonal movement is slightly faster[SOLVED]  (Read 8504 times)

Breadman

  • Full Member
  • ***
  • Posts: 185
  • Derp
Diagonal movement is slightly faster[SOLVED]
« on: November 11, 2013, 12:42:59 AM »
I'm using a standard FSM to control my character's movement. It's the same setup from the tutorials on the Playmaker website.

I've noticed that when moving diagonally (in relation to the camera), my character moves slightly faster than when moving in one direction.

Obviously the issue is not critical, it's perhaps a 5-10% speed increase. I can guess that it's coming from a combination of the two movement vectors being added/multiplied by each other.

Does anyone have any ideas/experience with clamping the character's movement speed to an absolute value, to prevent the slight diagonal speed increase?
« Last Edit: November 11, 2013, 01:19:16 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Diagonal movement is slightly faster
« Reply #1 on: November 11, 2013, 12:47:06 AM »
Hi,

 Yes, because you are combining 1 and 1 on a circle so you get more. few tricks:

-- Simply clamp the final input vector magnitude to 1
-- only get the direction and then apply a normalized speed
-- clamp the player speed itself.

bye,

 Jean

Breadman

  • Full Member
  • ***
  • Posts: 185
  • Derp
Re: Diagonal movement is slightly faster
« Reply #2 on: November 11, 2013, 12:52:02 AM »
Jean,

Have I ever mentioned how thankful I am for your constant support? You really are amazing. I really appreciate all your help, all the time.

Thanks for the advice - I had considered what you suggested, but I wasn't sure which to clamp - the Player Speed or the Vector3 Magnitude.

I've decided to clamp the vector3, and I THINK it worked. But now my brain is playing tricks on me, and is telling me the character is still mvoing slightly faster, although I'm not sure. Is there a way to display the character speed in-game every frame so that I can see the numerical value?


Breadman

  • Full Member
  • ***
  • Posts: 185
  • Derp
Re: Diagonal movement is slightly faster
« Reply #3 on: November 11, 2013, 01:05:09 AM »
Just kidding -

Global variables window > gear icon > "Debug variable values" checked

Thanks again!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Diagonal movement is slightly faster[SOLVED]
« Reply #4 on: November 11, 2013, 01:20:51 AM »
Hi,

 Thanks :)

 and to check the real final speed of your character, simply use the action "get speed".

bye,

 Jean