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.