playMaker

Author Topic: Character motor jump  (Read 14702 times)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Character motor jump
« on: July 16, 2012, 06:35:35 AM »
Hi,

 A lot of questions fired recently on the forum regards character jumping. So I am going to explain in this post how to implement it very easily.

The sample I will use to start is the ControllerSimpleMove sample provided by PlayMaker. Simply download the playmaker samples ( available in the "welcome screen" of PlayMaker).

The character set up uses a character Controller and a character Motor. But the FSM only tackle the character movement, not the jumping and you'll notice that the Character Motor component has a jumping section. So how can we benefit from the jumping system in the Character Motor?

Character Motor has an inputJump public property that is not visible in the inspector ( I know, not very clever nor obvious...). So what we need is to create a new Fsm on that gameObject and link that "inputJump" variable to the User's Jump Input.

First, make sure that the CharacterMotor component has the jump enabled, then you can do the following:

1: create a new fsm named "Jump character" attached to the character gameObject
2: add an Fsm boolean variable "jump input"
3: in the Start state ( name it "jump"), add a "Get Button Down" action and select the variable "jump input" in the field "Store result"
4: after the "Get Button Down" action, add a "Set Property" action
5: drag the "Character Motor" component in the "target Object". WARNING; really drag that component, make sure that "CharacterMotor" is displayed in grey in the "Object type" underneath the "Target Object" field
6: select the property "InputJump"
7: Select the Fsm Variable "Jump Input" in the field "Bool"
8: Make sure you check "Every Frame", else it won't work, we need to watch constantly for the jump input.

This is it, now you can run the scene, and press the space bar; the character will jump according to the jump settings defined in the CharacterMotor component.

Please find attached the package of the working scene.

Bye,

 Jean

Ps: this implementation is the most direct one, I will provide on my next post on jumping a custom jumping system made in playmaker so that it can serve as a base to expand on more complex jumping behaviour ( like multi jumps)


tom3d

  • Playmaker Newbie
  • *
  • Posts: 16
    • View Profile
Re: Character motor jump
« Reply #1 on: August 17, 2012, 12:20:05 AM »
Thant you very much, Very clear instructions!

brendang

  • Junior Playmaker
  • **
  • Posts: 59
    • View Profile
    • Out to Play Interactive
Re: Character motor jump
« Reply #2 on: August 17, 2012, 05:53:56 AM »
Jean,
If you ever find yourself in NYC...  The drinks are on me!
You are  well above the helpful mark!

This entire community has such a good vibe.  Beers for All!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: Character motor jump
« Reply #3 on: August 17, 2012, 08:18:19 AM »
Hi,

 I made a note to self :)  never been to NYC yet, going to california in december tho, too bad  :P  ;D

janvier18

  • Playmaker Newbie
  • *
  • Posts: 3
    • View Profile
Re: Character motor jump
« Reply #4 on: October 31, 2012, 08:56:45 AM »
Hello.
It works perfectly, thank you.
But i try to mix it with a touch event, for an ios project.
Can i keep this method, cause it uses getbuttondown ?
Otherwise, how can I do it ?
Thank you ! :)
« Last Edit: October 31, 2012, 09:07:13 AM by janvier18 »

amaranth

  • Full Member
  • ***
  • Posts: 172
    • View Profile
Re: Character motor jump
« Reply #5 on: October 31, 2012, 01:11:23 PM »
Jean, if you are going to be near San Francisco, I'll get you that beer!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: Character motor jump
« Reply #6 on: October 31, 2012, 10:51:14 PM »
Hi,

@janvier18:
 I'll see what I can do regards implementing touches on that package. Please bump this thread if you don't hear anything next week.

@Amaranth:
I am going to Los Angeles, and my schedule it packed so I don't think I am going to be able to trip to San Fransisco... would love it actually... but this is work trip, so don't think I will have day or two off I am afraid.

 If it turns out ok, I'll get in touch with you. It's not too far by train it seems.

bye,

 Jean

amaranth

  • Full Member
  • ***
  • Posts: 172
    • View Profile
Re: Character motor jump
« Reply #7 on: November 01, 2012, 04:11:40 PM »
L.A. is a great place to be in December! I hope you have a great trip, and if you do end up in San Fran at some point in the future, please let me know.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: Character motor jump
« Reply #8 on: November 02, 2012, 02:59:03 AM »
I will! :)

janvier18

  • Playmaker Newbie
  • *
  • Posts: 3
    • View Profile
Re: Character motor jump
« Reply #9 on: November 15, 2012, 11:29:36 PM »
Hi Jean !
I bump the topic as you said :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: Character motor jump
« Reply #10 on: November 16, 2012, 12:57:57 AM »
Hi,

 ok, please find a update version of another simple controller I did, and I added a touch pad texture on the right to jump, the fsm in itself is very simple, with a slight twist to make sure the jump input is not going into an infinite loop, but there are other ways to do it as well.

so you can apply the same technic wherever you want.

Bye,

 Jean

shinodan

  • Full Member
  • ***
  • Posts: 170
    • View Profile
    • Shinozone
Re: Character motor jump
« Reply #11 on: November 23, 2012, 04:30:34 PM »
Hey im still stuck regarding this, i need an action to make my char jump but diagonally off a wall. i tried adding a y value with controller move or controller simple move and it didnt work :(

Any simpler methods?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: Character motor jump
« Reply #12 on: November 25, 2012, 10:38:44 PM »
Hi,

 Look at the M2H platform jumper, I can jump off the sides fo platforms, so you might want to look at how I did it.

https://hutonggames.fogbugz.com/default.asp?W890

Bye,

 Jean

janvier18

  • Playmaker Newbie
  • *
  • Posts: 3
    • View Profile
Re: Character motor jump
« Reply #13 on: November 26, 2012, 10:06:06 AM »
Thanks Jean !
I just downloaded it, i will try.
Thanks a lot :)

tom3d

  • Playmaker Newbie
  • *
  • Posts: 16
    • View Profile
Re: Character motor jump
« Reply #14 on: November 26, 2012, 12:26:59 PM »
Thank you very much!