playMaker

Author Topic: Character Motor Jump? [SOLVED]  (Read 11511 times)

bigzer

  • Playmaker Newbie
  • *
  • Posts: 11
  • 1.3
    • View Profile
Character Motor Jump? [SOLVED]
« on: March 23, 2012, 06:09:10 AM »
Hi there,

I'm working on a character controller and I have a question concerning the Character Motor:

In the inspector character motor I see they mention "Jumping".
I'm not a scripter but I beleve the character motor script is listening and waiting for an input to perform a jump based on the parameters given in the inspector.

I don't find any action to fire it up (the jump). Am I missing something?

Using the "controller move" action I can move my character along the Y axis but obviousely it requires a lot of additionnal code to make it feel right, work that I think has already been crunched by Unity in the Character Motor script.

I had a look at Artician CharacterMotor and PlatformController actions but they dont have this feature unforunately.

Thanks for your insight :)


« Last Edit: March 26, 2012, 05:54:36 PM by Alex Chouls »

justifun

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 228
    • View Profile
Re: Character Motor Jump?
« Reply #1 on: March 23, 2012, 07:40:39 AM »
You actually just choose which button jumps via the player input preferences of unity itself.  Its joystick button 0 i think by default.

Then you would piggyback on top of that and use a "get button down" playmaker action to perform whatever you want along with that jump. eg: play animation.

does that make sense?

unity itself handles the jump of the character motor script.


also, one use of the character motor action is to disable jumping,  you can add it to a state and un-check the check box, and your controller will no longer be able to jump (eg: while he's standing in tar or something)

bigzer

  • Playmaker Newbie
  • *
  • Posts: 11
  • 1.3
    • View Profile
Re: Character Motor Jump?
« Reply #2 on: March 24, 2012, 09:57:21 PM »
Thank you for your answer.

I use this method but it doesnt seems to send anything to the character motor script.

In project settings/input I linked the Jump to mouse 0 (both jumps actually because there are 2).

I made a verry symple test attached to an empty game item, basically my start state is a 'get button down' with as button name 'Jump' and send event 'loop' to go back to the start state once pressed and listen for a new 'get button down' again.

When I run the game I can see that it registers the mouse click (I see the loop working in green in the playmaker fsm editor) but nothing happens, no jump at all.

I disabled playmaker scripts from my character and I reset to default the charactermotor inspector's config to no avail.

I probably miss something here but what's the catch here Oo?

Thank you for your help



bigzer

  • Playmaker Newbie
  • *
  • Posts: 11
  • 1.3
    • View Profile
Re: Character Motor Jump?
« Reply #3 on: March 25, 2012, 11:23:04 PM »
Following up,

It works when I replace the Character Motor Script with the Third Person Controller Script.
Sadly I need the Character Motor Script and not the Third Person one :(

Anyone got some ideas of what's going on here?
I'm loosing my marbles on this one ><

regards

bigzer

  • Playmaker Newbie
  • *
  • Posts: 11
  • 1.3
    • View Profile
Re: Character Motor Jump?
« Reply #4 on: March 25, 2012, 11:53:53 PM »
Found it...

I didnt know I had to add an input controller script...
Thx anyway :)

justifun

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 228
    • View Profile
Re: Character Motor Jump? [solved]
« Reply #5 on: March 26, 2012, 09:03:42 AM »
Glad you found a solution...

So what was final setup that worked?


iPetProjectDev

  • Playmaker Newbie
  • *
  • Posts: 23
    • View Profile
Re: Character Motor Jump? [SOLVED]
« Reply #6 on: May 22, 2012, 03:56:51 PM »
Cool. SOLVED..Good to know..but what was the solution as I am having the exact same problem and I already have a series of Fsm's that look like they step all over the input scripts in the Standard Assets. I hope we can get a proper SOLVED answer here about how to do this with an Fsm. I have the max and default speeds calculated at load by an Fsm which uses those values to drive a CharacterController and animation graph as per the tutorial series. It worked dandy. Now I added the CharacterMotor script and made a Jumper Fsm. The first state listens for a GetKeyDown event with the Space bar (tried it with no Fsm and of course it doesn't just work) which if true forwards to a Jump event. I have looked through the Actions and downloaded some here but there is no obvious way for me to tell the controller to jump when I do the bool test and advance to the state where the jump is made to occur. I can dynamically set the height, the acceleration in air and whether they get any further with a second hit of the space bar but I just want it to jump. The other input scripts do not use my controller scheme and I am also using the MasterCamera rig from the Assets Store so I am not stepping on that nice little piece of codework either with one of the standard scripts either.

What is the trick here using just Fsm's? (so this can properly be marked [SOLVED]).

TIA

iPetProjectDev

  • Playmaker Newbie
  • *
  • Posts: 23
    • View Profile
Re: Character Motor Jump? [SOLVED]
« Reply #7 on: May 22, 2012, 06:14:39 PM »
The trick here is really simple. You create the GetButtonDown listener action for the button controlling the jump. If TRUE then pass to the Jump event. The Jump event is wired to a State I call SendJumpMessage. I then SIMPLY dragged the CharacterMotor Component onto that State and chose the SetProperty. It gave me the inputJump boolean just like I needed. I set it using the GetButtonDown variable I originally stored in that action and then looped the outputs back to the GetButtonDown listener.

HTH anybody stuck with this. It also just opened my eyes to the wonders of dragging and dropping  my scripts onto the Fsm's and controlling them from there.. Like wow!

L8r

shinodan

  • Full Member
  • ***
  • Posts: 180
    • View Profile
    • Shinozone
Re: Character Motor Jump? [SOLVED]
« Reply #8 on: December 05, 2012, 03:20:37 AM »
Sorry im bumping this but i cant get this method to work as explained and being able to do this would work wonders for me.

Ps - Please please please help me lol
« Last Edit: December 05, 2012, 04:28:04 AM by shinodan »

Eirestudios

  • Playmaker Newbie
  • *
  • Posts: 8
    • View Profile
Re: Character Motor Jump? [SOLVED]
« Reply #9 on: December 14, 2012, 06:29:41 AM »
I'm also having problems with this, once I drag the script and use SetProperty and the target object i use is my player but it doesn't give me the inputJump boolean, can anyone help me out with this? Thanks in advance  ;D

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14703
  • Official Playmaker Support
    • View Profile
Re: Character Motor Jump? [SOLVED]
« Reply #10 on: December 14, 2012, 08:46:40 AM »
Hi,

 have a look at this:
http://hutonggames.com/playmakerforum/index.php?topic=1951.0

the inputJump bool is definitly there for a CharacterMotor component.

bye,

 Jean