playMaker

Author Topic: I need to rotate player when he pushed left or right on right stick?  (Read 2478 times)

westingtyler

  • Sr. Member
  • ****
  • Posts: 277
    • My Video Game Projects Web Site
I want the player to quick "comfort" turn" when he pushes the right stick to the right or left.

What is the best way to do a "get the right stick's left or right axis IF it changes beyond a certain threshold" thing? Like a "get button down/pressed" but for the right stick.

I tried to figure out get axis vector, and the other axis actions, but they seem to just check the current state when called, not trigger WHEN the stick is pressed. Any insight would help me a lot, guys! My game is getting awesome, all thanks to Playmaker!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: I need to rotate player when he pushed left or right on right stick?
« Reply #1 on: August 19, 2016, 07:03:12 AM »
Hi,
when the stick is pressed works as a button.
So you can use a state checking when that button is pressed and a state when it is released.
Then in the state that you are checking if the button is released you can add the axis actions.
if you don't understand what i mean let me know, then i can make a sample video later (not @ my computer atm)

westingtyler

  • Sr. Member
  • ****
  • Posts: 277
    • My Video Game Projects Web Site
Re: I need to rotate player when he pushed left or right on right stick?
« Reply #2 on: August 19, 2016, 03:25:14 PM »
I think I get it. Like, in input settings in unity, I set that axis to a button and name it, then I have the action event check if that button was pressed. Right?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: I need to rotate player when he pushed left or right on right stick?
« Reply #3 on: August 20, 2016, 10:08:02 AM »
Hi,
I thought you mend when the stick is pressed down,
you can use the get axis and store the value, and use a float compare, in float 1 set the variable from you axis, in float 2 set it to 0.
in tolerance set it to (for example) 0.5



You can also use a global and do the compare in a different fsm.

westingtyler

  • Sr. Member
  • ****
  • Posts: 277
    • My Video Game Projects Web Site
Re: I need to rotate player when he pushed left or right on right stick?
« Reply #4 on: October 11, 2016, 06:39:40 AM »
Yes, this is the approach I used. The problem I have is over or under sensitivity. if a person presses the stick but gently, it may not register the turn. if I make the range too big or small, sometimes it will trigger several times when I am releasing it. it is touchy.

The ideal solution would be "if player wasn't pressing the stick AT ALL, and now presses it AT ALL, execute the turn, and don't allow another turn until the stick has been fully released. Is this possible?

« Last Edit: October 11, 2016, 07:06:56 AM by westingtyler »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: I need to rotate player when he pushed left or right on right stick?
« Reply #5 on: October 11, 2016, 08:56:58 AM »
Hi,
You can place 2 float compares in state 1

in the first compare set float 2 to 1
and tolerance to 0

in the second set float 2 to -1
also tolerance to 0

in state 2 and 3 remove the tolerance