1
PlayMaker Help / Custom 2Dcontroller physics issue
« on: September 12, 2019, 08:10:13 AM »
Hello I'm using Playmaker on my first game and it's awesome, I had a lot of help by reading this forum already!
My game is a platformer 2D and I would like to have the same feeling as Celeste or Meatboy. I started to handle the control of the player by using a Rigidbody2D but I noticed that the jump is inconsistent and the ground check not really good.
Here is one of my issues:

The collider in red is to small and when i hit the border of a platform I can't jump anymore because the ground is not checked.

If i make the ground check collider bigger it might touch the wall when stick to a wall and can jump infinitely.

I tried using raycast2d but I had the same issue. the Ray origin was in the wall due to Physics that allow a small overlapping between the Rigidbody and the collider.
I saw some nice tutorial to create a controller without using Unity physics but they usually don't really explain well the logic behind the code:
https://www.gamasutra.com/blogs/YoannPignole/20131010/202080/The_hobbyist_coder_1_2D_platformer_controller.php
https://www.youtube.com/watch?v=OBtaLCmJexk&list=PLFt_AvWsXl0f0hqURlhyIoAabKPgRsqjz&index=2
My biggest issue is that I don't know how to use Raycast to set up the velocity of my controller. I have all the info with the Playmaker action but I'm lost when i need to use them.
Is it possible to combine as well Rigidbody with this Raycast solution?
OR to say that the raycast only detect a specific normal, so it will hit only the top edge of a boxcollider?
My game is a platformer 2D and I would like to have the same feeling as Celeste or Meatboy. I started to handle the control of the player by using a Rigidbody2D but I noticed that the jump is inconsistent and the ground check not really good.
Here is one of my issues:

The collider in red is to small and when i hit the border of a platform I can't jump anymore because the ground is not checked.

If i make the ground check collider bigger it might touch the wall when stick to a wall and can jump infinitely.

I tried using raycast2d but I had the same issue. the Ray origin was in the wall due to Physics that allow a small overlapping between the Rigidbody and the collider.
I saw some nice tutorial to create a controller without using Unity physics but they usually don't really explain well the logic behind the code:
https://www.gamasutra.com/blogs/YoannPignole/20131010/202080/The_hobbyist_coder_1_2D_platformer_controller.php
https://www.youtube.com/watch?v=OBtaLCmJexk&list=PLFt_AvWsXl0f0hqURlhyIoAabKPgRsqjz&index=2
My biggest issue is that I don't know how to use Raycast to set up the velocity of my controller. I have all the info with the Playmaker action but I'm lost when i need to use them.
Is it possible to combine as well Rigidbody with this Raycast solution?
OR to say that the raycast only detect a specific normal, so it will hit only the top edge of a boxcollider?