playMaker

Author Topic: Player Movement [SOLVED]  (Read 1885 times)

Grumpy Git

  • Playmaker Newbie
  • *
  • Posts: 10
Player Movement [SOLVED]
« on: April 14, 2018, 07:08:02 AM »
I'm new to Playmaker and I have a problem which is probably simple to resolve, but which I can't sort out.  I have my player moving forwards and backwards with W and S keys.  I'm trying to enable it to rotate left and right using the A and D keys, using the Rotate action.  The player does rotate but carries on spinning round even when I release the keys. The y axis is set to -2 for turning left, and every frame is checked.  Have I missed something?
« Last Edit: April 18, 2018, 01:53:02 PM by djaydino »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Player Movement
« Reply #1 on: April 14, 2018, 02:18:12 PM »
hi.
If you used "Get Key Down" in the 'Idle' state then on both states 'turn left' and 'turn right'
You need to set a "Get Key Up"  with the event transitioning to 'Idle' so Playmaker/unity knows you released the key.

Grumpy Git

  • Playmaker Newbie
  • *
  • Posts: 10
Re: Player Movement
« Reply #2 on: April 14, 2018, 04:56:25 PM »
Hi  Thank you for your reply.  There are no 'Get Key' actions in this state machine. Idle has just a 'Get Axis' action set to Horizontal and Left Event set to Left and Right Event set to Right.  The Turn Left and Turn Right states also have a Rotate action to turn -2 or 2 on the y axis.  If I just quickly press the A or D keys a small turn is made but if I press longer, to turn more, the character spins continually.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Player Movement
« Reply #3 on: April 15, 2018, 05:04:26 PM »
Hi,
Maybe you should place 'get axis' and rotate in a single state like this :




If the reaction is to slow you can adjust the sensitivity and the gravity in the input manager (Edit/Project Settings/Input)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Player Movement
« Reply #4 on: April 17, 2018, 01:55:41 AM »
Hi.
So i have been playing around with the axis event and i noticed that no Direction Event is only useful no direction (as it says)

for Example when pressed Press Left and it goes to the  'left' state
and you want to know if 'left' is released 'no Direction' is not usefull
because if i would 'rotate' my controller to the right it will always have a direction.

So i made an axisEndedEvent action which you can use to check if a direction is inactive again.

You can find it on the Ecosystem

Let me know if it works, or if you need some help.

Grumpy Git

  • Playmaker Newbie
  • *
  • Posts: 10
Re: Player Movement
« Reply #5 on: April 18, 2018, 05:55:39 AM »
Hi - thank you for your reply.  I have played around with settings following your advice, and the player now turns exactly as intended.  Thank you for your help

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Player Movement [SOLVED]
« Reply #6 on: April 18, 2018, 01:52:48 PM »
Hi.
Happy to help :)