Help with my argument please?

So this code ALMOST works. Basically I have a platform. If the player is below it, he ignores the collision. If he’s above it, or equal to it, it doesn’t ignore it. What happens is, he does ignore it, and when i jump above it, you can see him collide with it for a split second, and then it turns back off and he falls back through it. So my if statements works, but then it turns back off. Any suggestions on a better way to do this?

void FixedUpdate()
    {
        if(platform != null)
        {
            if(groundCheck.transform.position.y >= platform.transform.position.y && rigidBody.velocity.y <= 1)
            {
                ignoreCollision = false;
            }
            else
            {
                ignoreCollision = true;
                Physics2D.IgnoreCollision(playerCollBox, platformCollision);
                Physics2D.IgnoreCollision(playerCollCir, platformCollision);
            }
           
            if(ignoreCollision)
            {
                platformColor.color = Color.red;
            }
            else
            {
                platformColor.color = Color.green;
            }
        }
    }

What I’m wondering is: why the velocity check in ypur if statement? I’d bet that’s what’s tripping you up, unless you managed to jump onto the platform with just the right upward momentum, you’ll fall right through. Did you intend >= instead of <=?

I don’t think you want to check against the platform’s y position because, depending on where you have set the platform’s pivot point (or center, or local origin), the character could be above the pivot but still overlapping the actual platform, which might lead to the behavior you’re seeing.

Either take the dimensions of the platform into consideration in your comparison or use ray casts instead. I would probably go with the latter option as it is more reliable.

Also I think you should be comparing the velocity against zero, not one.