Physics2D.Linecast unreliable with Rigidbody2D interpolation? What to do

Hello I am creating a platform game and I am using Physics2D.Linecast to detect whether my character is on the ground and thereby able to jump. I am currently trying to implement platforms that fall down when you land on them. My problem is that sometimes when the character lands on one of the platforms I can see that the onGround bool is false. This confuses me a lot and I tried to use Debug.Drawline to draw the same line that Physics2D.Linecast is using and when I get those frames where onGround is false I can see that the line is in fact overlapping the collider on the platform and the onGround variable should therefore be true.

Both my character and the falling platform have rigidBody2D components attached to them with the interpolation setting turned on. I tried to test it without interpolation and it seems to work but it looks jittery and horrible. I am looking for some kind of explanation as to why this is happening and if anyone can come up with a way or some tip on how to make the Linecasting reliable it would be awesome. Thank you in advance.

The physics queries are ‘reliable’. It seems that you don’t understand what Interpolation actually is.

The physics system movement is based upon your fixed-update and therefore moves the physics bodies around in coarser steps and not per-frame. Interpolation (not extrapolation) moves the Transform-only per-frame from the last body position to the current body position to give smoother movement for things that render/depend on the Transform such as sprites etc. The physics body isn’t affected by interpolation, it’s the basis for the Transform updates only.

When you perform casts (etc), you are performing it against the body/collider positions and not against the Transform/GameObject/Sprite positions i.e. it has nothing to do with the Transform position. You can output this if you look at the Rigidbody2D.position as compared to the Transform.position.