playMaker

Author Topic: 2D Physics Based Platformer Tutorial  (Read 84318 times)

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
Re: 2D Physics Based Platformer Tutorial
« Reply #45 on: November 20, 2014, 08:36:43 PM »
well in that case, you can increase the mass of the character, to make it heavier, so it will feel more realistic, just try fiddling the mass character, and the jump force to get the best feel you're looking for...

When I increase mass on my character it doesn't really jump. Isn't there an action that temporarily increases mass when the player lands?

cloud03

  • Full Member
  • ***
  • Posts: 249
  • Viva Playmaker!
    • Milkish Game Studios Blog
Re: 2D Physics Based Platformer Tutorial
« Reply #46 on: November 20, 2014, 08:47:58 PM »
well you can set the rigidbody property while on air, and change the mass value...but it would be simpler if you just adjust the add force for jumping value, the default amount is 250, so if you increase the mass of the character, you will also have to increase the jump force.....but the gravity will be the same, so by changing both of those value, you still can jump high or low, and fall or lands quickly because of the higher mass...

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
Re: 2D Physics Based Platformer Tutorial
« Reply #47 on: November 20, 2014, 08:54:31 PM »
Just feel that when I set jump force, it's like no matter the amount, it doesn't feel as responsive as add force landing for forcing the player down. It's like theirs a delay or lag when the player jumps.

cloud03

  • Full Member
  • ***
  • Posts: 249
  • Viva Playmaker!
    • Milkish Game Studios Blog
Re: 2D Physics Based Platformer Tutorial
« Reply #48 on: November 20, 2014, 08:57:05 PM »
well in that case, you can modify the jump to tailor your needs, adding force while falling, or changing the mass temporarily while falling might be a solution.

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
Re: 2D Physics Based Platformer Tutorial
« Reply #49 on: November 20, 2014, 09:02:05 PM »
How would rigidbody mass be modified though if I had to use an action in order to achieve that? I can't use a force mode besides force, then it acts like the player is launched like a rocket out of control.

cloud03

  • Full Member
  • ***
  • Posts: 249
  • Viva Playmaker!
    • Milkish Game Studios Blog
Re: 2D Physics Based Platformer Tutorial
« Reply #50 on: November 20, 2014, 09:05:09 PM »
under jump state, after user press jump button, and add force action executed, drag the rigidbody component to that state and choose set property instead of get property, change the rolldown menu properties to mass (or something about mass), and a float input should be available, and change it to any amount you want, please refer to a set property action regarding this.

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
Re: 2D Physics Based Platformer Tutorial
« Reply #51 on: November 20, 2014, 09:14:28 PM »
Drag rigidbody component? So in add force, I would switch it to Specify Game Object?

cloud03

  • Full Member
  • ***
  • Posts: 249
  • Viva Playmaker!
    • Milkish Game Studios Blog
Re: 2D Physics Based Platformer Tutorial
« Reply #52 on: November 20, 2014, 09:20:37 PM »
the idea is changing the character rigidbody mass on runtime via playmaker states, and in order to do that, you'll have to use set property action. Set property action can modify any property from a component, for clearer explanation please refer to this tutorial:

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
Re: 2D Physics Based Platformer Tutorial
« Reply #53 on: November 20, 2014, 10:28:58 PM »
I see. It's working a lot better now. More responsive, however, when I set up a few platform cubes up, when I fall off of them, it acts like it's floating around in the air until a press space. Isn't there a way to resolve this issue like detection without another object on the button of the player to check whether or not theirs anything to detect?

cloud03

  • Full Member
  • ***
  • Posts: 249
  • Viva Playmaker!
    • Milkish Game Studios Blog
Re: 2D Physics Based Platformer Tutorial
« Reply #54 on: November 20, 2014, 10:59:50 PM »
Well instead using a trigger object for detecting ground, you can use raycast, I've uploaded a video tutorial on how to do that, but instead using raycast 2d like in the video, use raycast (without 2d) for 3d objects. Check the video on the first page, the first part of 2D Sprite Platformer series..

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
Re: 2D Physics Based Platformer Tutorial
« Reply #55 on: November 21, 2014, 02:56:20 AM »
Well instead using a trigger object for detecting ground, you can use raycast, I've uploaded a video tutorial on how to do that, but instead using raycast 2d like in the video, use raycast (without 2d) for 3d objects.

Did add the standard raycasting actions for the states, and added a ground tag to the platforms and ground. Still get the same results.

cloud03

  • Full Member
  • ***
  • Posts: 249
  • Viva Playmaker!
    • Milkish Game Studios Blog
Re: 2D Physics Based Platformer Tutorial
« Reply #56 on: November 21, 2014, 09:31:31 AM »
Can you send me your stripped down project? I'll take a look if you want...


cloud03

  • Full Member
  • ***
  • Posts: 249
  • Viva Playmaker!
    • Milkish Game Studios Blog
Re: 2D Physics Based Platformer Tutorial
« Reply #58 on: November 23, 2014, 04:18:49 AM »
Under raycast check, I think the wait action time is too long, perhaps set it to 0.1 or 0.2 should smooth things out...

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
Re: 2D Physics Based Platformer Tutorial
« Reply #59 on: November 23, 2014, 05:10:03 AM »
Tried that, still get the same results. What about adding raycast and everything else to the first state?