playMaker

Author Topic: How to make a Jump Pad  (Read 1851 times)

rlhalh

  • Playmaker Newbie
  • *
  • Posts: 3
How to make a Jump Pad
« on: October 30, 2018, 02:30:50 PM »
Hello all, I'm new with Playmaker and am attempting to make a pad that, when your player collides with it, will thrust you up. I have followed some tutorials about moving platforms and feel confident about setting Triggered Events properly, but I cannot get either Set Velocity or Add Force to work for me as the next action following the initial collision action event. I am using the character collider provided with the Unity character controller and, as mentioned, it work just fine with moving platforms.

Does anyone have any experience with jump pads? If so, could you give me a brief outline as to how to implement them for use with a player in a scene? Thanks.

Thore

  • Sr. Member
  • ****
  • Posts: 480
Re: How to make a Jump Pad
« Reply #1 on: October 30, 2018, 02:52:08 PM »
You could use physics materials and turn the bounciness up, this would however usually require that the character jumps on it. Right-click in project, create physics material, set values and then add it to the rigidbody (I believe).

Other than that, you may try a simpler setup first, to remove potential pitfalls. First get the trigger itself to work, i.e. you must set the collider to trigger, and use the correct actions, as well as correct components: rigidbody, colliders, and playmaker actions. If you use 2D, then all of these in their 2D versions, else, the standard ones (Unity was originally 3D only).

Next, remove a bit of complication and make a simple FSM and attach to player. First state listen to a key, get key down (tip as usual: in a real setup, you typically want to use button actions instead of keys, because they can be configured in input manager, but key down etc is good for initial setup and testing, as a kind of scaffolding). When the key is pressed, apply velocity upwards. Again, watch out, if you work in 2D, you need velocity2D and corresponding components.

If that works, you can tweak this easily, how much velocity, how high etc. Next, combine both. When the trigger is activated, you need to check that it registers the correct player object (with rigidbody on it, etc), and then simply copy over the state with the velocity that worked. Lastly, the makeshift FSM on the player can be deleted as the velocity is induced from the triggering object.

It’s always a good idea to break down the problem into simpler chunks and hook them up quickly, so you can test them rapidly, especially circumstantial designs (if player goes there, does this and that, then this and that needs to happen).

Hope that helps.
« Last Edit: October 30, 2018, 02:59:34 PM by Thore »

rlhalh

  • Playmaker Newbie
  • *
  • Posts: 3
Re: How to make a Jump Pad
« Reply #2 on: October 30, 2018, 03:11:31 PM »
Thanks for the response. To be clear, I'm working in 3D not 2D so don't have to take the 2D component requirements into consideration.

I don't have a good feel for how to use Add Force and have been working from this video to try to get some clarity with it:


I have had success with moving platform creation using this video:


I have successfully set up Trigger Event actions (as shown in the second video) and have tried to use this to lead to another State that gives the Add Force action to the Player (as shown in the first video). My Events are there and I created the variable 'Player' as it is needed for the Add Force action. However, it doesn't do anything when I test it.

I'm missing something somewhere, just wish I could find it to understand things better.

Thore

  • Sr. Member
  • ****
  • Posts: 480
Re: How to make a Jump Pad
« Reply #3 on: October 30, 2018, 03:42:55 PM »
I never use add force, it seems to require every frame or something for it says “continuously” in the documentation (I may be mistaken). Did you try add velocity? Did you check that the player game object is stored when entering the trigger? Go step by step. Debug and find out where exactly it is stuck (observe variables while playing etc).

If you use add force, you could try set it to every frame for testing. Then you can add a wait action in the same state to limit how much force is applied over time, e.g. say 2 seconds. If that does nothing, try velocity.
« Last Edit: October 30, 2018, 03:44:55 PM by Thore »

rlhalh

  • Playmaker Newbie
  • *
  • Posts: 3
Re: How to make a Jump Pad
« Reply #4 on: October 30, 2018, 03:46:03 PM »
I believe the game object was stored but that's a great observation. I did try Add Velocity, but did not have the every frame option chosen. When I have a moment I'll set that parameter and see what happens. Thanks.