playMaker

Author Topic: Custom 2Dcontroller physics issue  (Read 925 times)

Thore

  • Sr. Member
  • ****
  • Posts: 388
    • View Profile
Re: Custom 2Dcontroller physics issue
« Reply #15 on: September 21, 2019, 02:17:32 AM »
Hi,

I made GetAxisRaw, it’s here:
https://hutonggames.com/playmakerforum/index.php?topic=19333.0

For multiple collision checks, I wrote above already to shoot several rays, like two or three downwards, use the hit property (return true when hit something) and the  feed them into Bool Any True, which then returns isGrounded, if any ray hit something. The key for performance is to do such things in a single state.

Then, the jumping is another fsm, where first you listen for button down, and when pressed, you go to the check state to see if you can jump. Here you get FSM bool isGrounded, and if true proceed.

I do a short grace period there, because you want the jump to register even if the player pressed a few frames too early. To do this, use a frequent pattern: make all checks every frame and move on to jump when successful (but nothing on fail, just keep checking). Put a wait action on top with a very short grace time. If the wait time runs out without that the checks proceed, abort the jump attempt. And to be sure, you can also abort jump attempt with a Button Up. If the button is released while checking, also abort jumping.

« Last Edit: September 21, 2019, 02:20:23 AM by Thore »

strawberries036

  • Playmaker Newbie
  • *
  • Posts: 10
    • View Profile
Re: Custom 2Dcontroller physics issue
« Reply #16 on: September 21, 2019, 09:10:31 AM »
Thanks Thore. I have been able to move the P31 Character Controller with editing the custom Action. All the collisions are pixel and frame perfect, but I notices that the character was jittering a bit after few moves. So I'll try to see what's going on there.
If I can manage to a have smooth moves and perfects collision, my next tasks will be easier (ground checking, jumps, wall jumps etc...)
Your idea of a second check with a wait is interesting and could work well.
If I'm giving up on writing or updating this custom controller I will definitely do that.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15205
  • Official Playmaker Support
    • View Profile
Re: Custom 2Dcontroller physics issue
« Reply #17 on: October 02, 2019, 12:44:58 AM »
Hi,

 have you studied the 2d platformer I made in playmaker? jump is just fine. I think you may over engineer this.

https://hutonggames.com/playmakerforum/index.php?topic=11881.0

Bye,

 Jean