0
\$\begingroup\$

Character falls through the Platform Effector 2D in Unity. How can I fix it?

Here is the demonstration: https://imgur.com/G5YkTxa.

I tried changing the Edit - Project Settings... - Physics 2D - Default Contact Offset from the current 0.01 value to the 0.1 value. The result is the same and here is the demonstration of it: https://imgur.com/3TAOsNY.

Here are my settings for the platform:

enter image description here

Here are my settings for the character's RigidBody 2D:

enter image description here

Here is what character colliders look like when my character runs: https://imgur.com/CTialU3.

I basically run the recorded inside Unity animation of running and move my character with the help of the:

        private void FixedUpdate()
        {
            ... some code which computes the velocity vector depending on the input (the pressed buttons)
            characterRigidBody2D.velocity = velocityVector;
        }

I googled for a while now similar issues, but was not able to find a solution. I want to avoid the character falling down randomly during running.

\$\endgroup\$
3
  • \$\begingroup\$ You probably don't want to be using polygon colliders for a platformer character. A capsule is going to give you better consistency, performance, and lower risk of tunneling through collisions like this. Can you also show us your velocity computation, and what value the velocity has at the time the fall through the platform occurs? \$\endgroup\$
    – DMGregory
    Commented Feb 13, 2021 at 17:28
  • \$\begingroup\$ @DMGregory, I really did not want to resort to the one collider per character solution. Even if it is a widespread approach, I feel satisfaction by making the character colliders as accurate as possible. So, I just added an edge collider under the character. A lot of my issues got gone after that. Including the issue described in the question. imgur.com/LLBr0WB. Thank you for your time. \$\endgroup\$
    – some1 here
    Commented Feb 14, 2021 at 12:44
  • \$\begingroup\$ Sounds like you should post that as an Answer below. \$\endgroup\$
    – DMGregory
    Commented Feb 14, 2021 at 12:46

1 Answer 1

0
\$\begingroup\$

I really did not want to resort to the one collider per character solution. Even if it is a widespread approach, I feel satisfaction by making the character colliders as accurate as possible. So, I just added an edge collider under the character. A lot of my issues got gone after that. Including the issue described in the question.

enter image description here

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .