playMaker

Author Topic: How to get the player move faster when running  (Read 988 times)

Nim

  • Playmaker Newbie
  • *
  • Posts: 9
How to get the player move faster when running
« on: March 17, 2021, 08:44:15 AM »
Hi, I'm newbie & sorry for asking noob question but I'm having trouble in creating player movement especially running & jumping.

Running:
I use rigidbody instead of char.controller. In the 1st state, I place pic 1 setting & upon press of shift, it will go to state 2 (pic 2) & go back to state 1 when I release the key. I want to change the speed faster whenever I hit shift, but above setting doesn't do as intended. It still move when in 1st state but "dash" forward when I release the shift (in state 2). Where did I do wrong?

Jumping:
In jumping, how I can make the player able to jump higher based on his speed? example, if he's "walking" to "jumping" only able to jump height of 1 meter & move forward 1 meter. But if he's running then he can jump higher & move forward further. My current setting is able to move player forward but I want to know how to get the desired result.

jumping state 1:
set velocity (Y vector) -> get velocity (Y vector) -> float compare (less than then "fall")

jumping state 2:
get velocity (Y vector) -> float multiply -> set velocity (Y vector)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: How to get the player move faster when running
« Reply #1 on: March 17, 2021, 11:03:06 AM »
Hi.
Instead of get Axis vector you can use Get Axis (and set 'Horizontal') instead of the 1st 3 actions you use.
On the Get Axis you can set the Multiplier as a variable.

This variable you can change to change speed.
To change you should do this from a different fsm by using 'Set Fsm Float'

so on a different fsm you can do get key down (shift)

when shift pressed, set multiplier value to 5
when released (or after a certain time) set multiplier value to 3

for jump you could get the velocity when you start the jump and based on that you  can set a certain velocity accordingly.

Nim

  • Playmaker Newbie
  • *
  • Posts: 9
Re: How to get the player move faster when running
« Reply #2 on: March 17, 2021, 01:33:51 PM »
Hi Djaydino,

Thanks for the advice. Speed can be changed now by following your advice. However, my idle & walk animation is not showing. I use blend tree for these 2 anims with float parameter so I can't direct set specific float. How can I make the idle-walk anim play accordingly?

Also I use get axis vector previously to hook my camera to follow player (3rd person), but I don't know where I should "hook" the camera now?

For jumping, I still can't get it working..  :(

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: How to get the player move faster when running
« Reply #3 on: March 17, 2021, 03:06:33 PM »
Hi.
you should be able to adjust the threshold, so it works.

for camera you can set a separate fsm with the get axis vector

for jump what exactly is not working?

Nim

  • Playmaker Newbie
  • *
  • Posts: 9
Re: How to get the player move faster when running
« Reply #4 on: March 17, 2021, 04:44:47 PM »
Hi Djaydino,

Thanks. Finally can make it works. However, what can I do to prevent backward jumping? Like when I click "S" & "Space" it can also jump. This also happen in running. Can you please help?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: How to get the player move faster when running
« Reply #5 on: March 17, 2021, 04:55:38 PM »
Hi.
You could use float clamps

set min to for example -50 and max to 50
But set them as variables.

When jump starts check direction, then if right set min to 0 and max to 50
if left set min to -50 and max to 0

When land set back to min -50 and max 50

Nim

  • Playmaker Newbie
  • *
  • Posts: 9
Re: How to get the player move faster when running
« Reply #6 on: March 18, 2021, 12:09:54 PM »
Hi Djaydino,

Thanks a lot for your help. I still have issue with the camera, but will check on the forum first.  :)