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)