playMaker

Author Topic: Player bouncing on top of the ladder [SOLVED]  (Read 1048 times)

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • View Profile
    • Homepage
Player bouncing on top of the ladder [SOLVED]
« on: November 21, 2017, 07:05:42 AM »
Hi!

Is there a way to avoid the player bouncing or jumping on the top of the ladder after he is finish climbing? Please watch the video so you can see if you don't understand exactly what I mean.

In a very old platformer I was working on, I fixed this to just turn on kinematic on the player when he is on the top of the ladder and turn it off again when I move the player left or right. That was with Unity 5.4.1, but after Unity 5.5.0, they did some changes on Rigidbody 2D, so I got a lot of problems with this.

I have tried a lot of things already and nothing works properly, so I don't know how to solve it. Please give me suggestions I can try. :)

https://www.youtube.com/watch?v=wAImvHpaLOc&feature=youtu.be
« Last Edit: November 23, 2017, 01:27:59 AM by djaydino »
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4582
    • View Profile
    • jinxtergames
Re: Player bouncing on top of the ladder
« Reply #1 on: November 21, 2017, 09:42:49 AM »
Hi,
Maybe some gravity settings  when close to the top.

Can you pm me a sample scene, so i know your setup and can try to find a solution.


Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • View Profile
    • Homepage
Re: Player bouncing on top of the ladder
« Reply #2 on: November 21, 2017, 02:30:51 PM »
Hi, djaydino!

Thank you! I will pm you a sample scene in a few minutes. :)
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • View Profile
    • Homepage
Re: Player bouncing on top of the ladder
« Reply #3 on: November 21, 2017, 02:36:43 PM »
Quote
Can you pm me a sample scene, so i know your setup and can try to find a solution.

Now you can check your mail. :)
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • View Profile
    • Homepage
Re: Player bouncing on top of the ladder
« Reply #4 on: November 21, 2017, 02:43:28 PM »
I couldn't send you any file as a pm, so I send it here. :)
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4582
    • View Profile
    • jinxtergames
Re: Player bouncing on top of the ladder
« Reply #5 on: November 22, 2017, 04:39:04 AM »
Hi, i tested a little and i think this is ok :

i made a sprite from the ladder and placed this above the ladder with a box collider 2d (disabled) and turned off the sprite renderer.

Then on the ladder fsm in the on ladder state i use the custom action Enable Collider 2D to enable the collider and in the wait(Ofll Ladder) state i disable the collider.
And also on the jump fsm on the do jump state i have a Enable Collider 2D to disable the collider.

If you have several ladders drop all the colliders as a child and use Incl Children.


Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • View Profile
    • Homepage
Re: Player bouncing on top of the ladder
« Reply #6 on: November 22, 2017, 03:13:34 PM »
Quote
Hi, i tested a little and i think this is ok :

i made a sprite from the ladder and placed this above the ladder with a box collider 2d (disabled) and turned off the sprite renderer.

Then on the ladder fsm in the on ladder state i use the custom action Enable Collider 2D to enable the collider and in the wait(Ofll Ladder) state i disable the collider.
And also on the jump fsm on the do jump state i have a Enable Collider 2D to disable the collider.

If you have several ladders drop all the colliders as a child and use Incl Children.

Hi!
Thank you. I was thinking of to use colliders like this, but I didn't know about Enable Collider 2D. Very useful. But since I use a tilemap editor and all the ladders are tile-based, I don't have all the colliders as childs of a folder, but then I discovered Enable Collider 2D With Tag, so all the colliders will enable and disable at the same time. It works very well...in the editor, but...can you try to make a build of the ladder sample scene I sent you, after you made the changes? Because it doesn't work in the build. I don't know if it's because of the changes I did. But in the Ladder Raycast FSM, it doesn't go to the state "Up -> Down Disable Collider" when I climb down from the top of the ladder. It works only in the editor. Not in the build

Take a look at this video:

Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • View Profile
    • Homepage
Re: Player bouncing on top of the ladder
« Reply #7 on: November 22, 2017, 11:55:36 PM »
I found the problem. You need to set the collider to ignore raycast. I think on the FSM Ladder Raycast, the Raycast hits the collider in the build, but not in the editor. It works fine now. :) Just some few other bugs I need to fix with the animation.

Thanks for your help djaydino! :)
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4582
    • View Profile
    • jinxtergames
Re: Player bouncing on top of the ladder
« Reply #8 on: November 23, 2017, 01:27:42 AM »
Hi.
No problem, happy to help :D

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • View Profile
    • Homepage
Re: Player bouncing on top of the ladder [SOLVED]
« Reply #9 on: November 24, 2017, 01:06:39 AM »
I just have one other question. It's the almost the same thing, so I post it here instead of creating a new topic. :)

Is it a way to avoid the player to slide down on a slope?
See the video.

Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no