playMaker

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

cloud03

  • Full Member
  • ***
  • Posts: 230
  • Viva Playmaker!
    • View Profile
    • Milkish Game Studios Blog
Re: 2D Physics Based Platformer Tutorial
« Reply #75 on: November 25, 2014, 07:33:46 PM »
You can just try to open it on 4.2.2, if its not working, then upgrade the Unity.

I would also recommend to back any other project into a zip, so if something went wrong, you can extract it again from the zip files...

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: 2D Physics Based Platformer Tutorial
« Reply #76 on: November 26, 2014, 12:47:30 PM »
On your end, how do you feel about how jumping reacts? Because when I get to other platforms it doesn't feel as responsive as the first platform and even those objects are tagged.

cloud03

  • Full Member
  • ***
  • Posts: 230
  • Viva Playmaker!
    • View Profile
    • Milkish Game Studios Blog
Re: 2D Physics Based Platformer Tutorial
« Reply #77 on: November 27, 2014, 02:25:36 AM »
On my end it feels fine for me, no difference on the jumping effects..

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: 2D Physics Based Platformer Tutorial
« Reply #78 on: November 27, 2014, 02:31:25 AM »
What about touching a end of a platform or side that's like a wall? Because when I do that when I fall off of one, when I press space, it stops or acts like it's stuck.

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: 2D Physics Based Platformer Tutorial
« Reply #79 on: November 27, 2014, 07:24:54 PM »
Plus, when I set up the FSM the way that you did for jumping it doesn't respond until I connected to the states that were like yours like 40 times. But when the raycast down state with a jump transition flowing into the Jump now state it has the low gravity affect. I think this isn't normal because I also recall that your projects FSM only gave the player the ability to jump once, and for some reason that isn't the case for mine.

In terms of how the players rigidbody is set up, since I made it a bit smaller then yours. It's set up this way.

The players scale on Transform is following.

X Y and Z = 1.8

Players rigidbody

Mass = 3.1
Drag = 0.14
Angular Drag = 0.45
« Last Edit: November 27, 2014, 07:36:52 PM by coffeeANDsoda »

cloud03

  • Full Member
  • ***
  • Posts: 230
  • Viva Playmaker!
    • View Profile
    • Milkish Game Studios Blog
Re: 2D Physics Based Platformer Tutorial
« Reply #80 on: November 27, 2014, 11:10:15 PM »
for when the player is on the edge, the problem is the raycast only start from the middle point, so it doesn't hit the ground, you'll have to add another raycast from the edge of the bounding box of the player with direction also down to detect this, you can search tutorial regarding raycast for this issue.

As for your FSM not working, I'm not sure what causing it. I've set it once and it worked right away, so there is must be something wrong going on, can you check my tutorial again, see if you missed a step?

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: 2D Physics Based Platformer Tutorial
« Reply #81 on: November 27, 2014, 11:24:00 PM »
for when the player is on the edge, the problem is the raycast only start from the middle point, so it doesn't hit the ground, you'll have to add another raycast from the edge of the bounding box of the player with direction also down to detect this, you can search tutorial regarding raycast for this issue.


Don't understand. You added another raycast action in your modified version of my project? Don't think I spotted that unless you are talking about going back to your tutorial which did rely on a separate cube on the bottom of the character with another FSM. Like I said, I'm kind of confused because I am using the same actions as your project.


As for your FSM not working, I'm not sure what causing it. I've set it once and it worked right away, so there is must be something wrong going on, can you check my tutorial again, see if you missed a step?

If I'm not mistaken the project that you uploaded seems to differ from your tutorial series. I recall that you added a global variable as well as making a transition global on another FSM.


cloud03

  • Full Member
  • ***
  • Posts: 230
  • Viva Playmaker!
    • View Profile
    • Milkish Game Studios Blog
Re: 2D Physics Based Platformer Tutorial
« Reply #82 on: November 28, 2014, 03:45:52 AM »
Don't understand. You added another raycast action in your modified version of my project? Don't think I spotted that unless you are talking about going back to your tutorial which did rely on a separate cube on the bottom of the character with another FSM. Like I said, I'm kind of confused because I am using the same actions as your project.


Nope, the one I've created indeed has a problem on the edge, and it is caused because on the edge, the raycast doesn't hit the ground, so to fix it, you'll have to add yourself another raycast but with a slight shifted origin on the x axis, so that one will still detect the ground when the player is on the edge, please refer to the 1st pic

If I'm not mistaken the project that you uploaded seems to differ from your tutorial series. I recall that you added a global variable as well as making a transition global on another FSM.

The basic system for the jumping is actually the same, the one in the tutorial and the project, the same theory applies, regarding global variable, I'm not quite sure what you meant with it? the one that using raycast does not need global variable at all to jump, local will do.
« Last Edit: November 28, 2014, 03:50:53 AM by cloud03 »

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: 2D Physics Based Platformer Tutorial
« Reply #83 on: November 28, 2014, 01:43:11 PM »
In the first part of the 2d sprite platform tutorial? I thought in Part 1 when you covered raycasting you made a transition(Do Jump, On Ground) global to work in two FSMs all at the same time.
« Last Edit: November 28, 2014, 02:41:37 PM by coffeeANDsoda »

cloud03

  • Full Member
  • ***
  • Posts: 230
  • Viva Playmaker!
    • View Profile
    • Milkish Game Studios Blog
Re: 2D Physics Based Platformer Tutorial
« Reply #84 on: November 28, 2014, 04:05:39 PM »
Can you check it again:
I'm sorry I cannot help you further, cause I don't know what makes it doesn't work on your end, everything running fine here, although for the raycast on the edge you'll have to try adding yourself, but the concept just like the picture I've attached before...

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: 2D Physics Based Platformer Tutorial
« Reply #85 on: November 28, 2014, 04:13:22 PM »
I will take a second look at it. I could be mistaken with the first series of tutorial videos that you covered regarding a 2.5D environment instead of full 2D like you just posted above.

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: 2D Physics Based Platformer Tutorial
« Reply #86 on: December 01, 2014, 06:45:33 PM »
When I set up the movement the way that you do in your 2d sprite tutorial, along with just a rigidbody and capsule collider, the keys go in the opposite direction compared to what value of X is on both flipping states?

cloud03

  • Full Member
  • ***
  • Posts: 230
  • Viva Playmaker!
    • View Profile
    • Milkish Game Studios Blog
Re: 2D Physics Based Platformer Tutorial
« Reply #87 on: December 02, 2014, 05:19:21 AM »
The flipping method are not meant for the 3D version, it is used for the sprite version, so for rotating character, better use the look at method (the 2.5D tutorials, not the sprite ones). As for the jumping system, raycast actually will be better than using a trigger object as the ground detector, so better only to adapt the jump system using raycast, and leave the other system like described from the tutorial.

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: 2D Physics Based Platformer Tutorial
« Reply #88 on: December 05, 2014, 07:54:30 PM »
Watched the 2.5D tutorial up till you went into animation, and while falling is more responsive now on my end, I still have the player sticking on to tagged objects when I hit A or D keys when colliding. And jumping still looks like low gravity. When I use Get Property to increase mass, it's permanent? I want the mass to reset itself.

cloud03

  • Full Member
  • ***
  • Posts: 230
  • Viva Playmaker!
    • View Profile
    • Milkish Game Studios Blog
Re: 2D Physics Based Platformer Tutorial
« Reply #89 on: December 07, 2014, 02:34:12 AM »
Well you can change its mass when jumping, and upon landing, change the value back to normal, I think that'll do.